Let's start with the basics that have already been pointed out. A lens with an f/1.2 maximum aperture needs to be (at least) one and a half times larger in diameter than a lens with an f/1.8 maximum aperture. 1.5 times the diameter (and thickness, of course) means 2.25 times the area and 3.375 times the volume of glass. And that means that you can expect to pay about three and a half times as much if the designs are otherwise identical. They aren't.
Lens elements that are composed of spherical curves are relatively easy to grind and polish. I say "relatively easy", but getting the kind of precision required for focusing light cleanly still takes a bit of doing. The shape must be perfectly radially symmetrical, or the lens will exhibit astigmatism (that's where lines at different angles will focus at different distances). If the curve deviates sagittally—if the cross-sectional shape of the lens is off—you'll get coma (a smearing of the image outward from the centre). The larger the lens element, the more precise the grinding and polishing have to be to avoid astigmatism and coma.
Lenses can be thought of as prisms with a continuous curve. If there were only one element, even if that element is made of the finest and most advanced optical glass ever formulated, you would get a tremendous amount of lateral and longitudinal chromatic aberration. That's essentially a prism doing what prisms do: the bend different wavelengths of light by slightly different amounts, producing the familiar rainbow spectrum. The larger a lens is, the more difference there will be in the angle of incidence of the light at the centre of the lens and the light at the edges, and the worse the chromatic aberration will be.
While a spherical shape is easy to produce (either convex or concave), spherical lenses (and mirrors) can't focus light from all points of the lens in the same place. That's called spherical aberration, and it results in a blurry image. Again, the larger the lens, the worse the problem gets. A very, very tiny (slow) lens can get away with being spherical without much penalty; a large (fast) lens will be terminally soft without major correction.
Most of the problems with real-world lenses come from the lens having a large diameter. There are ways of correcting the problems (like using convex/concave pairs of elements to undo the rainbow problem, aspherical—and much harder to grind and polish—elements to reduce or eliminate spherical aberration, using exotic glasses and crystals to minimize chromatic dispersion, and so on), but the larger the diameter of the lens, the more needs to go into correcting the problems. If an f/1.2 lens had the same design as the f/1.8 lens, either the 1.2 would be terminally soft with heavy colour fringing, or the 1.8 would be overdesigned to a ridiculous degree and outrageously costly.
That's just the optics. Now take into consideration that if you want the f/1.2 lens to focus on the same day that you pressed the shutter button halfway, with glass that is going to weigh at least three and a half times as much, you're going to need a stronger focus motor, and the focusing mechanism (the helicoids and gears and so on) needs to be much stronger to cope with the additional force required.
And now that we've gotten to the point that the lens is going to be considerably more expensive anyway, it's time to consider what people are going to expect from an investment of that magnitude. It's one thing to have to buy a $120 lens every few years if you have to; it's quite another to have to pop for a lens that's going to cost, say, a thousand dollars anyway (if only the minimum optical and mechanical upgrades are done). The build quality of the lens isn't just a luxury—no pro is going to invest in something that is both expensive and disposable, so the lens needs to be built more solidly and with a bit more safety factor in the engineering. Add in features that working pros are going to want (like weather sealing) and the cost rises again, but not as much as those things that are necessary just to make an f/1.2 lens work well. And there's one last thing to take into account: when you make expensive things, you don't get as many people buying them, so you lose the economies of scale.
So whether it's the red ring on a Canon "L" lens, or the equivalent gold ring on a Nikon, you're not just paying for a racing stripe and bragging rights. If you don't need the lens, don't buy it. If you do need the lens, though, you're not being charged an "idiot tax"—they actually are a lot more expensive to produce and distribute.
Some lenses have more glass (bigger aperture requires bigger glass elements).
Some lenses have better quality lens elements to combat chromatic aberrations, distortion and vignetting.
Some lenses have better build quality (the 50mm f/1.8 has a plastic body and is relatively poorly built).
Some lenses are weather sealed (more complex to build).
Some lenses have better electronics and motors.
Some lenses are newer (somebody have to pay for all the R&D).
And finally, some lenses are more expensive because they are targeted at richer customers (pricing a pro lens at $100 is stupid - someone who uses it to make money will easily afford much more).
- 1.2 vs 1.8 means larger glass elements = more cost
- "L" lenses are higher quality. See What is the difference between Canon "L" lenses and non-L lenses?
The primary difference between those two lenses is indeed the aperture. A difference between f/1.8 and f/1.2 is actually quite large, and a non-trivial exercise from a manufacturing standpoint. There are additional improvements in the f/1.2 version as well, including a metal lens tube, ultrasonic autofocusing, additional corrective lenses for optical aberrations, etc.
To get back to the aperture, which is the most significant difference. At its simplest, the relative aperture is measured as the diameter of the opening in the diaphragm as a ratio of the lenses focal length. For the two lenses in question, the relative apertures are 27.7mm for the f/1.8 and 41.6mm for the f/1.2. In and of itself, that is a difference of 1.5x, or a 50% larger aperture on the EF 50mm f/1.2 L series lens.
When it comes to aperture though, the absolute area is really what matters...the full area of the opening in the diaphragm is what allows light through the lens to reach the sensor. In the case of the two 50mm lenses at hand, the f/1.8 has a maximum aperture area of 606mm^2, while the f/1.2 has a maximum aperture area of 1363.5mm^2. That is a very non-trivial difference of 125%, or 1 1/4 stops! That is more than a doubling of the amount of light that can pass through the lens, making it more than twice as fast. (It should be noted that an F-Number of f/1.2 is often used in the 1/3rd stop scale of apertures, however as the math shows, an f/1.2 lens is actually more than 1 full stop faster than f/1.8, as the 1/3rd stop scale would indicate. An f/1.3 aperture would be closer to a full stop, or 2x the amount of light as an f/1.8 aperture.)
The aperture of a lens is also a bit more complex than simply the area of the opening in the lens diaphragm. Optically, the aperture is the area of that opening as seen through the front of the lens (at a distance of "infinity"). Another term for the aperture area is the entrance pupil of the lens. For the entrance pupil to appear as large as it must, a large enough front lens element must be used, and the compilation of lens elements within the lens barrel must support the necessary magnification to produce an aperture of the right size.
Making a large diaphragm with a large opening is not particularly costly, although it does add some cost. Making that diaphragm use curved blades that supports nice, smooth out-of-focus blur makes it a little bit more expensive. However it is primarily the amount of glass, including both the large front element necessary to achieve the required entrance pupil and additional glass elements required to correct optical aberrations, that really adds to the cost (defect-free optical glass ain't cheap!) Small lens elements can be made en-mass with little or no manual process, and are thus cost-effective. Large lens elements such as those used in EF 50mm f/1.2 L series lenses usually require a fair amount of manual process intervention, sometimes even requiring that the lens be assembled manually by a person. Between the glass, other high quality parts like a metal lens barrel and mount, ultrasonic AF motors with full-time manual focus, and the quality of hand craftmanship, the fourteen-fold price difference is generally warranted. There is probably a bit of "name cost" involved, as you are buying one of the best-made lenses on the planet when you pick up a Canon L-series lens...but that is still a minor factor in the grand scheme of things.
An analogy that come to mind is squeezing juice out of a lemon. I think the same principles go for lemon juice and for instance lens aperture.
To get some juice (≥ f/1.8) out the lemon doesn't really take much effort, just a firm grip would do...
Getting most of the juice (f/1.4 ?) out of it require a whole lot use of force. It surely gets tougher towards the end and your knuckles are turning white.
Extracting every single existing drop (≤ f/1.2) of juice out of that goddamn lemon is almost freaking impossible. You know there is more in there, but no matter how hard you wrap your hand around that thing, nothing comes out - aaargh!
Does that make sense?
aside from the optics (where the differences are not subtle), the f1.8 version produces an atrocious bokeh due partly to it's 5 non-rounded blade aperture. You can spot the harsh busy bokeh immediately when compared with the results of the f1.4 or the f1.2 version. Personally, the extreme DOF is exactly what I want from this lens. (I only have the f1.4 version and hope to eventually get the f1.2 for this very reason) I almost always use the f1.4 fully open and with an ND filter. To get even thinner DOF and the bokeh near perfect and silky smooth along with the weather sealing (i use the current lens a lot in rain or after rain) Other guys spend their money on golfing, fishing, home entertainment systems, I'd rather get me a nice lens instead.
The F number is the ratio between focal length and the the apparent light opening size. this means that you have to make a larger lens for the same focal length. you also get a larger surface that hte light rays enter, and they all have to be focused onto a little dot, smaller than your pixel size to be sharp. If you at the same time have a zoom lens this is even more difficult, especially if you want to keep the same ratio. Even more complexity. So you see how fixed aperture lenses are hard to make. Furthermore, they are also more sought for, especially by professionals - this also adds to the price, and even more value, as they choose to make them dedicated for pros, meaning overall build quality is boosted as well.
So in conclusion, the things that make them costly are:
- More weight, more material
- Optically more complex to make, especially zooms
- and more especially fixed wide aperture zooms
- cheaper versions are often very soft wide open, especially zooms.
- the demand is high
- the wide aperture lenses are also often "made for pros"
To answer your specific question, two lenses from the same premium brand, yes 1.8 to 1.2 doesn't sound much, but involves a lot more glass! And when something costs more to make, and will sell fewer units, the price goes up a LOT!
The game is changing now we're all using digital cameras. Some attributes of a 'good' lens must be designed 'in the glass'. But some types of distortion can be easily and efficiently corrected in software.