I am powering a 12V 6W lightbulb with two 9V zinc-carbon batteries in series. The voltage should be high enough to power the lightbulb, but the light is only visible for around 40 seconds before it quickly dims out. Can you please help me understand this?
A 12V/6W bulb has a nominal resistance of V^2/W = 144/6 = 24 ohms.
At 18V a 24 ohm load draws 18/24 A = 750 mA.
A 9V battery typically only has a mAH capacity of around 200 mAH or less -- and note this varies depending on the current draw.
So that's why your 9V batteries don't last very long when powering this light blub.
Here's some tests performed on 9V batteries which give you an idea of how the current load affects battery life:
9V zinc-carbon battery has low capacity (200-400 mAh). Two batteries in series will have the same capacity. More important, it has very high internal resistance, about 25 ohms, and that increases as it discharges, which means it is not capable of providing high current.
9V batteries are intended for very low power appliances, like smoke detectors.
The solution to your problem is:
Use LEDs, which provide the same light for 10x less current (at least)
Use batteries with a voltage that suits the LEDs and the chosen driver, to maximize its efficiency.
Even for LEDs, a 9V battery isn't a good choice, as 2-3 AAs cost less, deliver more capacity and higher current, and the voltage matches one LED better.