You may want to review multiplying complex numbers first.

One nice thing about i is that it's a very easy number to raise to powers. Of course, i0 = 1, since anything raised to the 0 power is 1, and i1 = i since anything raised to the 1 power is itself. Also, i2 = −1; that's the whole point of i. It follows that i3 = −i and i4 = 1. From then on, the cycle just keeps repeating. So, to compute in (for any whole number n), just divide n by 4 and look at the remainder. If it's 0, the answer is 1. If it's 1, the answer is i. If it's 2, the answer is −1. Finally, if it's 3, the answer is −i.