MATLAB: How can i use the roots function to show that all the roots of a complex number lie on a circle.

circlecomplexcomplex numberscomplex planefunctionhomeworknumbersrootsroots function

The question gives the following information: Given z=1+3i , what is z^1/4 where arg(z) is in the range: pi/2 < arg(z) < pi I am looking how i would go about using the roots function to solve the problem and how i would find the other roots to generate a figure which shows that all the roots lie on a circle in the complex plane. My code so far without using the roots function:z = 1+3i; Im = imag(z); Re = real(z); Mag = abs(z); theta = atan(Im/Re); %more data of powers n = 1/4; k = 1:4; arg = (theta*n + (2*k*pi)*n) x = cosd(arg); y = 1i*sind(arg); r = Mag.^(n); zn = r.*(x) + r.*(y); zn = zn' Any advice would be greatly appreciated.

Best Answer

Well, you did make an effort. Something we see too little of from students lately. :)
You want to find the 4 roots of a complex number.
z = 1+3i;
Just use roots, on the polynomial
x^4 - z == 0
Clearly, any solutions to that equation must be roots of z. That takes no more than
format long g
r = roots([1 0 0 0 z])
r =
-1.18702520404887 + 0.607659917216594i
-0.607659917216594 - 1.18702520404886i
0.607659917216592 + 1.18702520404886i
1.18702520404886 - 0.607659917216592i
We can view those numbers in polar form. The radial component would be:
abs(r)
ans =
1.33352143216333
1.33352143216332
1.33352143216332
1.33352143216332
That is consistent with this prediction:
nthroot(abs(z),4)
ans =
1.33352143216332
Are they on a circle? Of course.
plot(real(r),imag(r),'bo')
axis equal
grid on
r1 = abs(r(1));
t = linspace(0,2*pi,100);
hold on
plot(r1*cos(t),r1*sin(t),'r-')
Note that axis equal was important there, otherwise the plot would look elliptical.
If you want to convince yourself the points are equally spaced around the circle, try this:
(angle(r) - min(angle(r)))/pi
ans =
1.5
0
1
0.5
So the differences between each point in angle is a nice simple multiple of pi.
One caveat to remember: this exposition using roots shows only that the roots of THIS PARTICULAR complex number lie on a circle. While we know it to be true in general, this is not a proof of the general case.