Solving complex linear equations with conjugate operations

46 Views Asked by At

Consider the following equations: $$\left\{ \matrix{ {z_1} + {z_2} = 9 + 5i \hfill \cr \overline {{z_1}} + 2{z_2} = {z_1} + 10 + 2i \hfill \cr} \right.$$

Assuming ${z_1} = {x_1} + i{y_1}$ and ${z_2} = {x_2} + i{y_2}$, substitute them to equations $$\left\{ \matrix{ {x_1} + i{y_1} + {x_2} + i{y_2} = 9 + 5i \hfill \cr {x_1} - i{y_1} + 2\left( {{x_2} + i{y_2}} \right) = {x_1} + i{y_1} + 10 + 2i \hfill \cr} \right.$$ The real parts and imaginary parts correspondingly equate: $$\left\{ \matrix{ {\mathop{\rm Re}\nolimits} ({x_1} + i{y_1} + {x_2} + i{y_2}) = {\mathop{\rm Re}\nolimits} (9 + 5i) \hfill \cr {\mathop{\rm Re}\nolimits} ({x_1} - i{y_1} + 2\left( {{x_2} + i{y_2}} \right)) = {\mathop{\rm Re}\nolimits} ({x_1} + i{y_1} + 10 + 2i) \hfill \cr {\mathop{\rm Im}\nolimits} ({x_1} + i{y_1} + {x_2} + i{y_2}) = {\mathop{\rm Im}\nolimits} (9 + 5i) \hfill \cr {\mathop{\rm Im}\nolimits} ({x_1} - i{y_1} + 2\left( {{x_2} + i{y_2}} \right)) = {\mathop{\rm Im}\nolimits} ({x_1} + i{y_1} + 10 + 2i) \hfill \cr} \right.$$

Regarding ${x_1},{x_2},{y_1},{y_2}$ as unknowns, rearrange to obtain the linear system form $Ax=b$. $$A = \left( {\matrix{ 1 & 0 & 1 & 0 \cr 0 & 0 & 2 & 0 \cr 0 & 1 & 0 & 1 \cr 0 & { - 2} & 0 & 2 \cr } } \right),x = \left( {\matrix{ {{x_1}} \cr {{x_2}} \cr {{y_1}} \cr {{y_2}} \cr } } \right),b = \left( {\matrix{ 9 \cr {10} \cr 5 \cr 2 \cr } } \right)$$ The result is (using $A{\rm{\backslash }}b$): $$\left\{ \matrix{ {z_1} = {\rm{4 + 2i}} \hfill \cr {z_2} = {\rm{5 + 3i}} \hfill \cr} \right.$$

My questions:

  1. For complex linear equations involving conjugate operations, is it necessary to calculate them separately?

  2. This is just an example. I intend to use this approach to address other similar systems of complex linear equations.In my calculations for other instances, I found the determinant of $A$ to be 1e-6, approximately zero. How should I handle this to ensure the accuracy of the equation solutions?

My MATLAB code is attached below.

clc;clear;close all;
%% Set a question
z_1_true=4+2i;%The true value of z1
z_2_true=5+3i;
ee1=z_1_true+z_2_true;%Constant term
ee2=conj(z_1_true)+2*z_2_true-z_1_true;
%% taking the real part and the imaginary part respectively, twice the number of equations
syms z_1 [2 1] real%z1
syms z_2 [2 1] real%z2
z1_com=z_1(1)+1i*z_1(2);%z1_com represents the complex form of z1 
z2_com=z_2(1)+1i*z_2(2);
eqns2_com=[z1_com+z2_com-ee1;
    conj(z1_com)+2*z2_com-z1_com-ee2];%Construct complex equation
eqns2=[real(eqns2_com)==0;imag(eqns2_com)==0];%Taking the real part and the imaginary part
vars=[reshape(z_1,1,2),reshape(z_2,1,2)];%The variables need to be solved
[A2,b2] = equationsToMatrix(eqns2,vars);%Extract the A and b matrices

Sol2=double(A2)\double(b2);%calculation method
z1_sol2=Sol2(1)+1i*Sol2(2);z2_sol2=Sol2(3)+1i*Sol2(4);
E11=z1_sol2+z2_sol2-ee1;
E22=conj(z1_sol2)+2*z2_sol2-z1_sol2-ee2;
disp('Solve separately:');
disp(['true value of z1:', num2str(z_1_true),',result:',num2str(z1_sol2),',Error of first equation:',num2str(E11)]);
disp(['true value of z2:', num2str(z_2_true),',result:',num2str(z2_sol2),',Error of second equation:',num2str(E22)]);
2

There are 2 best solutions below

1
On BEST ANSWER

It is usually done separately for real and imaginary but its not hard doing it by hand

$$ \bar{z_1}+2z_2=z_1+10+2i\\ 2z_2-(z_1-\bar{z_1})=10+2i $$

Since $z_1-\bar{z_1}$ is purely complex the real part of $z_2$ must be $5$

$$z_1+z_2=9+5i$$

This means the real part of $z_1$ is $4$

Now you can solve normal 2 variable for imaginary parts

Note: Your answer seems to be wrong might want to check again and MATLAB is wayyy too overkill

0
On

Multiply the first equation by $-2$ an add both equatuions. Immediately we'll get $z_1=4+2i$. Now solve for $z_2$.