Another way of looking at it: from the point (x, y) in the coordinate plane, draw a perpendicular to the x-axis. That, the x-axis itself, and the line from (x,y) to the origin, which has length make a right triangle. The "opposite side", parallel to the y-axis, has length and the "near side", along the x-axis, has length .
The standard convention for representing complex numbers as points in the plane, sets the imaginary part of the number to the y-coordinate and the real part to the x-coordinate. That gives . Of course, your example, [itex]x+ iy= cos(\theta)+ i sin(\theta)[/itex], implies that [itex]r= |x+ iy|= 1[/itex]