Which expression to use for electrical power? 
We know that electric power can be written as $P=VI$, or $P=\frac{V^2}{R}$, or $P=I^2R$.

But when to use which one? Sometimes two different formulas give different results! Please explain with some examples.I 'm feeling very confused!
 A: The product of the instantaneous voltage across and current through a circuit element gives the instantaneous power delivered to the circuit element (assuming passive sign convention).
$$p(t) = v(t) \cdot i(t)$$
This holds regardless.  For particular circuit elements, one can eliminate one of the variables, e.g.
Resistor:  $v = Ri$
$$p(t) = Ri^2(t) = \frac{v^2(t)}{R}$$
Inductor:  $v = L\frac{di}{dt}$
$$p(t) = Li\frac{di}{dt}$$
Capacitor:  $i = C \frac{dv}{dt}$
$$p(t) = Cv\frac{dv}{dt} $$
A: All 3 formulas are true for a $V$ and $I$ that are constant in time.  Imagine there is a constant voltage $V$ across a resistor $R$.  By Ohms Law this causes a current $I={V\over R}$ to flow through the resistor.  The power being dissipated by the resistor is 
$$
P=IV
$$
Ohms Law says $I={V\over R}$ so substitute this into the first equation for $I$ to get
$$
P={{V^2}\over R}
$$
Ohms Law also says $V=IR$ so substitute this into the first equation for $V$ to get
$$
P=I^2 R
$$
Now, for a time varying voltage, look at a single frequency $V=V_0 cos(\omega t)=RealPart(V_0e^{j\omega t})$ and $I=I_0 cos(\omega t-\phi)=RealPart(I_0e^{j(\omega t-\phi)})$ . The angle $\phi$ is the phase shift between $V$ and $I$ caused by the complex $Z=|Z|e^{j\phi}$ in Ohms Law. The formulas for Ohms Law and time-averaged (dissipated power) are still true just in slightly modified form (the hats indicate complex numbers) and the brackets <> mean time-averaged.
$$
\hat {V}= \hat{I} \hat{Z}
$$
$$
<P>={1\over2}I_0 V_0 cos(\phi)
$$
$$
<P>={1\over 2}{{V_0^2}\over {|Z|}} cos(\phi)
$$
$$
<P>={1 \over 2}I_0^2 |Z| cos(\phi)
$$
where Z is the complex impedance of the circuit you want the power dissipation for.  You make Z by adding up complex impedances $R$, $j\omega L$, and ${1 \over {j\omega C}}$ of components as if they were resistors using your series and parallel formulas.  The ${1\over2}cos(\phi)$ come from integrating the product of two cosines when doing the time- average.
Complex impedances are described in many text books and web links ... here is one link that also derives the $<P>$ formulas.
