This is what I have done.
Group real numbers and imaginary numbers
Solve for real number
Solve for imaginary number
.. Can someone verify if it's legal to divide both sides by ?
Yes, the division by is legal. However, these sorts of problems are easiest if you realise that for two complex expressions to be equal, their real parts have to be equal and their imaginary parts have to be equal.
So if you write each side in terms of its real and imaginary parts, then you can equate real and imaginary parts.
In your case:
Now equate real and imaginary parts:
and .