# Determine polynomial coefficients so that it's roots lie on the unit circle

31 views (last 30 days)

Show older comments

Given the quadratic function in ℂ, I want to know under what conditions for a and b, all polynomial roots lie on the circle center (0,0) radius 1.

I started off with

syms a b

p = [1 a b];

roots(p);

r = roots(p);

So that r(1) and r(2) are the roots of my polynomial (z_1, z_2).

Now, these solutions lie on the unit circle if and only if their distance to the origin (their modulus) is less than or equal to 1.

According to MATLAB Documentation, the abs() function returns "absolute value and complex magnitude", but when i try

abs(r(1))

MATLAB isn't really taking into consideration that this number can be a complex number and just returns a positive version of itself.

What am I doing wrong or not considering?

P.S. I know this is something which can be done off by hand, but I also want to learn MATLAB, not only solve my problem.

##### 4 Comments

Walter Roberson
on 13 Mar 2021

### Answers (3)

Bruno Luong
on 16 Mar 2021

Edited: Bruno Luong
on 16 Mar 2021

For

P(z) = a*z^2 + b*z + c;

I claim this is these two conditions are equivalent to the fact that P has two roots on unit circle (a/b/c coefficients can be complex or real, no restriction whatsoever):

- |a| = |c|
- b = rho*sqrt(a*c) for arbitrary rho, real such that |rho| <= 2

>> a = randn()+1i*randn();

>> c = a*exp(2i*pi*rand); % first condition

>> rho = 4*(rand()-0.5); b = rho*sqrt(a*c); % second condition

>> abs(roots([a b c]))

ans =

1.0000

1.0000

Another equivalent way to write these two conditions are:

- |b| <= 2*|a|
- rho := +/- |b|/|a|
- c = (b/rho)^2/a

>> a = randn()+1i*randn();

>> rho = 4*(rand()-0.5); theta=rand()*2*pi; b = rho*exp(1i*theta)*a;

>> c = (b/rho)^2/a;

>> abs(roots([a b c]))

ans =

1.0000

1.0000

It is probably equivalent to other answers, I did not read them carefully.

##### 0 Comments

Basil C.
on 13 Mar 2021

For the equation always has roots in complex field C.

Let p and are its complex roots,

then product of roots is = b

Since you need roots lie on the circle |z|=1

Hence for any real value of a such that or the complex root will lie on circle

To prove via matlab

syms a b

p = [1 a b];

r = roots(p)

value_of_b = solve(r(1)*r(2)==1,b)

You can verify the above results using

r = roots([ 1 1.5 1]);

abs(r(1))

abs(r(2))

##### 1 Comment

Walter Roberson
on 13 Mar 2021

Let the roots of the polynomial be 1+1i and 2-2i then the polynomial is

syms z

f(z) = expand((z-(1+1i)) * (z-(2-2i)))

R = fliplr(coeffs(f(z), z))

roots(R)

We have confirmed that the polynomial has the roots we choose.

However... the roots are not complex conjugates of each other.

If we let the roots be c+1i and d+i/2 real c d

syms c d real

f(z) = expand((z-(c+1i)) * (z-(d+i/2)))

R = fliplr(coeffs(f(z), z))

a = R(2)

b = R(3)

roots([1 a b])

confirming that we extract the roots correctly.

and we want abs() of them to be <= 1

syms d1 d2

assume(d1>=0 & d2>=0)

simplify(expand((c+i)*conj(c+i) + d1 == 1^2))

sol = solve(simplify(expand((d+i/2)*conj(d+i/2) + d2 == 1^2)), d, 'returnconditions', true)

sol.d

sol.conditions

So for example,

F(z) = expand((z-i)*(z-(1/4-i/2)))

Fsol = solve(F)

abs(Fsol)

simplify(abs(Fsol) <= 1)

Complex roots that are not complex conjugate, but are on or inside the unit circle.

R = fliplr(coeffs(F(z), z))

%is a^2 < 4*b ?

[R(2)^2, 4*R(3)]

The two parts are complex; one is not less than or greater than the other.

John D'Errico
on 13 Mar 2021

Edited: John D'Errico
on 14 Mar 2021

This seems simple enough, though the result may not seem terribly pretty. Brute force often has that result.

syms a b z

P = z^2 + a*z + b == 0;

zsol = solve(P,z)

No constraints on a and b so far here, these are the roots. But since a and b could be complex, we want to know if the roots lie in the unit circle. And that rquires they must have magnitude less than or equal to 1. We can get the square of the magnitudes as simply:

zmag = expand(diag(zsol*zsol'))

So zmag is always a vector of length 2. The requirement for the roots to lie in the unit circle in the complex plane is a simple one, only that both elements of zmag MUST be no larger than 1. (They will always be real and non-negative by construction, even for complex a and b.)

There is no need to take the sqrt there. All we need is for both elements of zmag to be <= 1, so we have a pair of simple inequality constraints. if zmag is <= 1, then sqrt(zmag) is also <= 1. This is a constraint purely on a and b, and both constraints must apply for both roots to lie inside the unit circle. The sigma terms in there are just to make it look a little neater. I could use matlabFunction to express it in the form of a function handle, if I wanted.

zmagfun = matlabFunction(zmag,a,b)

The only real question is if this can be simplified. I'm not sure that is necessary or if even easy to do. But it answers the question directly as a strict pair of constraints on a and b, such that the roots lie as needed.

We can try an example:

atest = rand() + i*rand()

btest = rand() + i*rand()

double(subs(subs(zmag,a,atest),b,btest))

Remember, they are the SQUARES of the root magnitudes. Since BOTH elements of zmag are <= 1, then I will predict the roots lie inside the unit circle in the complex plane.

Verify that, by computing the roots themselves.

zroots = roots([1,atest,btest])

abs(zroots).^2

The square of the root magnitudes is correct. As predicted, both roots lie inside the unit circle. Had I chosen atest and btest differently, the roots need not lie inside the unit circle. (In fact, I made several random attempts before I found a pair that yieled roots inside the unit circle. Most of my initial trials seemed to fall with one inside and the other outside.)

Finally, I might add that interesting variations on this problem could be to find the locus of solutions such that both roots lie EXACTLY on the perimeter of the unit circle, or to find the locus of solutions such that a and b are real numbers. But those were not the questions posed here.

For example, if a and b are real numbers, how does zmag simplify? We might do this:

assume(a,'real')

assume(b,'real')

simplify(zmag)

That result is much simpler. Now a little effort would allow you to plot the region of interest.

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!