I found another thread that went through some of the derivation:
https://www.physicsforums.com/showthread.php?t=267367
They talk about phasor representations and so on, which is a little beyond my mathematical knowledge so I think I'll just have to learn the relationship you gave me.
How would...