Words like "quality" imply "goodness" and can be misleading when used in technical contexts. The quality factor, Q, of a resonant system is considered to be high if the system loses little energy over time compared to the energy in the system. A swing set that swings hundreds of times after a single push would be "high Q" when compared to a swing set that stops after a few swings due to excessive friction in the bearings. Inductors and capacitors that exhibit low loss will make high Q tuned circuits as will low friction spring-mass mechanical systems and such components are generally high quality. But it isn't always a good thing to have high Q. Next time your car hits a pothole, thank your shock absorbers for giving your car suspension a miserably low Q. Tuned circuits in your radio must have just the right amount of Q, not too much and not too little. Too much Q and some of the modulation's spectrum is missed; too little and other signals or excessive noise gets through. Although high Q is not always desired, it is usually true that it is best to have high Q components like inductors and capacitors or springs, and bearings that are intentionally damped by resistors, dashpots, or other lossy devices so that the designer maintains good control over the value of Q.
A simple definition of Q could be the ratio of the total energy in a system to the energy lost per cycle. Now that is a sensible and easy to remember definition but this is an arbitrary definition which we are free to "mess with" and there is a change that makes the math easier. Lets make the definition the ratio of the total energy in a system to the energy lost per radian. What? Why use a fraction of a cycle? Well, there are 2 pi radians per cycle and by using radians, a bunch of 2 pi's drop out of many useful Q equations. This makes the Q about 6 times higher than it would have been with our original simpler definition. There are two equivalent ways to say it:
Q = (2 pi) (total stored energy) / (energy lost per cycle)
Q = (total stored energy) / (energy lost per radian)
If you feel like you are going to forget the 2 pi in a few years, just try to remember that "cycles-per-second" or "Hz" are usually not used in these types of calculations because radians are more mathematically convenient. Whenever "frequency" or "cycles" appear in formulae involving impedances, try to think in "radians".
Imagine a "parallel" tuned circuit where the inductor, capacitor, and resistor are all connected in parallel. First lets consider the numerator, the total stored energy. One can write an equation for the instantaneous energy in the capacitor as a function of the sine wave voltage and in the inductor as a function of the sine wave current; square each one and add to get the total. Or, one can take a shortcut! At some instant all of the energy will be in the capacitor (when the voltage is at a peak). The energy in a capacitor is "one-half C V-squared":
w = (C x V2) / 2
where V is the peak voltage.
In the Q equation, the denominator is the energy lost in the resistor during one radian which is the watts (joules per second) divided by the radian frequency. (If you lose X power per second, you will lose X/radian frequency in one radian's time.) The power lost in the resistor is the RMS voltage squared divided by the resistance ("v-squared over R"). Well, the RMS voltage is 0.707 times the peak voltage for a sine wave and when you square 0.707 you get 0.5 giving "0.5V-squared over R" where V is the peak voltage. To get the power lost per radian, we divide by w (radian frequency).
The Q equation becomes:
(C V2) / 2 (0.5) V2 / wRp = wRpC
Q = wRpC
See how tidy it becomes!
By using the formula for resonance, w = 1 / (LC)1/2, it is easy to show that:
Q = Rp (C / L)1/2 = Rp / Xc
= Rp / Xl
Q = Rp / X
where X is the reactance of the inductor or capacitor (they are equal in magnitude at resonance). The little subscript "p" reminds us that this is a parallel resistance.
A similar exercise can be done for the series tuned circuit case but it shouldn't be a big surprise to see these results:
Q = wL / Rs
Q = 1/Rs (L/C)1/2 = Xc / Rs
= Xl / Rs
Q = X / Rs
For a capacitor with series resistance:
Q = 1/ wCRs
In a parallel tank a large shunt resistor gives high Q and in a series tank a low series resistor gives a high Q (note the R in the numerator in one and denominator in the other). In a parallel tank low reactance "shorts out" the resistor making the Q high and in a series tank high reactance makes the small series resistor insignificant (note C/L in one and L/C in the other).
Formulae that relate the parallel and series cases for a fixed Q may be derived:
First assume that the impedance of the parallel and series networks are equal at resonance:
Zs = Rs + j Xs = Zp = Rp j Xp / (Rp + jXp)
to start separating the real and imaginary parts, multiply the right-hand terms by (Rp - jXp / Rp - jXp):
Zp = (Rp Xp2 + j Rp2 Xp) / (Rp2 + Xp2)
Rs + j Xs = (Rp Xp2 + j Rp2 Xp) / (Rp2 + Xp2)
Separating the real and imaginary parts:
Rs = Rp Xp2 / (Rp2 + Xp2)
Rs = Rp / (1 + Rp2 / Xp2)
Rs = Rp / (1 + Q2)
Xs = Rp2 Xp / (Rp2 + Xp2)
Xs = Xp / (1 + Xp2 / Rp2)
Xs = Xp / (1 + 1 / Q2)
The math turns out to be simple when considering the effects on the bandwidth of a tuned circuit, too:
Q = frequency / bandwidth
where the frequency is the resonant frequency of the tank and the bandwidth is the frequency difference between the 3 dB points.