It's a fundamental principle in electrical engineering, if you have a 2-lead device like a resistor, the power used by the device is equal to voltage across the device times current through the device.
\$P = IV\$
If the current flows through the device from the higher-voltage side to the lower voltage side, the device is consuming power (or dissipating it as heat). If the current flows through the device from the lower-voltage side to the higher voltage side (for example, if the device is a battery or power supply) then we consider the current to have a negative sign (for example, -10 mA) and the device is delivering power to the rest of the circuit.
Wikipedia has a page on electric power, but it quickly gets into more complex cases (like AC circuits) because for DC it really just boils down to this one equation.
If someone asked for the average power dissipated in a device, what
would that mean?
The average power is the time average of the instantaneous power. In the case you describe, the instantaneous power is a 1W peak square wave and, as you point out, the average over a period is zero.
But, consider the case of (in phase) sinusoidal voltage and current:
$$v(t) = V \cos \omega t $$
$$i(t) = I \cos \omega t $$
The instantaneous and average power are:
$$p(t) = v(t) \cdot i(t) = V_m \cos\omega t \cdot I_m \cos\omega t = \dfrac{V_m \cdot I_m}{2}(1 + \cos2\omega t) $$
$$p_{avg} = \dfrac{V_m \cdot I_m}{2}$$
(since the time average of sinusoid over a period is zero.)
In the above, we evaluated the time average of the instantaneous power. This will always give the correct result.
You link to the Wiki article on AC power which is analyzed in the phasor domain. Phasor analysis assumes sinusoidal excitation so it would be a mistake to apply the AC power results to your square wave example.
The product of the rms phasor voltage \$\vec V \$ and current \$\vec I \$ gives the complex power S:
$$S = \vec V \cdot \vec I = P + jQ$$
where P, the real part of S, is the average power.
The rms phasor voltage and current for the time domain voltage and current above are:
$$\vec V = \dfrac{V_m}{\sqrt{2}} $$
$$\vec I = \dfrac{I_m}{\sqrt{2}} $$
The complex power is then:
$$S = \dfrac{V_m}{\sqrt{2}}\dfrac{I_m}{\sqrt{2}} = \dfrac{V_m \cdot I_m}{2}$$
Since, in this case, S is purely real, the average power is:
$$P = \dfrac{V_m \cdot I_m}{2}$$
which agrees with the time domain calculation.
Best Answer
You have used the peak value of current in your solution.
The RMS value of current is of course \$\dfrac{3}{\sqrt{2}}\$ = 2.121 amps and this flows thru the 100 ohm resistor producing a power of
\$(\dfrac{3}{\sqrt{2}})^2\times 100\$ = 450 watts.
Remember the current is flowing through the resistor so you don't need to care about it also flowing thru the inductor and your angle of 0.229 is meaningless and also incorrect due to rounding errors.