# Solving equations with complex or real or imaginary number

GG = {N3*Conjugate[N3]+ N4*Conjugate[N4] == 1, (2 N3 + (-I + Sqrt) N4)/(2 Sqrt) == 0};
Sols = Solve[GG, {N3, N4}]


I need to solve the above equation. But I didn't get an answer!!! Can you please help. This N3 and N4 will be sometimes complex number or real number or imaginary number.

• FullSimplify[Sols] I get on Mathematica 12.1.1.0: {N3 -> ConditionalExpression[-(1/2) (-I + Sqrt) N4, And[ Or[Im[N4] + (Rational[4, 7] - Re[N4]^2)^Rational[1, 2] == 0, Im[N4] == (Rational[4, 7] - Re[N4]^2)^Rational[1, 2]], Inequality[(-2) 7^Rational[-1, 2], LessEqual, Re[N4], LessEqual, 2 7^Rational[-1, 2]]]]} Nov 19, 2020 at 0:49

Split the complex variables N3,N4 into real and imaginary part and ComplexExpand it.

GG = {N3*Conjugate[N3]+ N4*Conjugate[N4] == 1, (2 N3 + (-I + Sqrt) N4)/(2 Sqrt) == 0};

GG2 = GG /. {N3 -> n31 + I n32, N4 -> n41 + I n42}

ceRe = ComplexExpand[Re[GG2 /. Equal -> Subtract],
TargetFunctions -> {Re, Im}] // Simplify

ceIm = ComplexExpand[Im[GG2 /. Equal -> Subtract],
TargetFunctions -> {Re, Im}
] // Simplify


You get only solutions for three of the four variable, one you can choose free within a given range.

Here choose n42 from -2/Sqrt to 2/Sqrt and look at the solutions for the other variables.

sol = Solve[Join[Thread[ceRe == 0], {ceIm[] == 0}], {n31, n32, n42, n41},
Reals] // Simplify

Plot[Evaluate[{n31, n32, n41} /. sol[[1 ;; 2]]], {n42, -(2/Sqrt),
2/Sqrt}, PlotStyle -> {Red, Green, Blue
}] Or choose n31 free in the range +-Sqrt[3/7]

sol2 = Solve[Join[Thread[ceRe == 0], {ceIm[] == 0}], {n32, n41, n31, n42},
Reals] // Simplify

Plot[Evaluate[{n32, n41, n42} /. sol2[[1 ;; 2]]], {n31, -Sqrt[(3/7)],
Sqrt[3/7]}, PlotStyle -> {Green, Blue, Magenta
}]

Clear["Global*"]

GG = {N3*Conjugate[N3] + N4*Conjugate[N4] ==
1, (2 N3 + (-I + Sqrt) N4)/(2 Sqrt) == 0};


There are an unlimited number of solutions

Sols = Solve[GG, {N3, N4}][] The condition is

cond = Sols[[1, -1, -1]]

(* (Im[N4] == -(Sqrt[4 - 7 Re[N4]^2]/Sqrt) && -(2/Sqrt) <= Re[N4] <= 2/
Sqrt) || (Im[N4] == Sqrt[4 - 7 Re[N4]^2]/Sqrt && -(2/Sqrt) <=
Re[N4] <= 2/Sqrt) *)


Some examples of N4 values

inst = FindInstance[cond, N4, 5, RandomSeeding -> 1234] // FullSimplify

(* {{N4 -> -((I (-805 I + Sqrt))/2324)}, {N4 -> -(2/Sqrt)}, {N4 -> (
I (1085 I + Sqrt))/2324}, {N4 -> 2/Sqrt[
7]}, {N4 -> -((I (-525 I + Sqrt))/2324)}} *)


The associated {N3, N4} pairs are

{N3, N4} /. Sols /. inst // Simplify

(* {{((1 + I Sqrt) (-805 I + Sqrt))/
4648, -((I (-805 I + Sqrt))/2324)}, {(-I + Sqrt)/Sqrt[
7], -(2/Sqrt)}, {((-I + Sqrt) (1085 - I Sqrt))/4648, (
I (1085 I + Sqrt))/2324}, {-((-I + Sqrt)/Sqrt), 2/Sqrt[
7]}, {((1 + I Sqrt) (-525 I + Sqrt))/
4648, -((I (-525 I + Sqrt))/2324)}} *)


Reduce work.

GG = {N3*Conjugate[N3] + N4*Conjugate[N4] ==
1, (2 N3 + (-I + Sqrt) N4)/(2 Sqrt) == 0};
Sols = Reduce[GG, {N3, N4}]

-Sqrt[(3/7)] <= Re[N3] <= Sqrt[3/
7] && (Im[N3] == -(Sqrt[3 - 7 Re[N3]^2]/Sqrt) ||
Im[N3] == Sqrt[3 - 7 Re[N3]^2]/Sqrt) &&
N4 == -((2 N3)/(-I + Sqrt))
`