# System of nonlinear complex-valued equations using Solve

I'm trying to figure out the proper syntax to use in Mathematica to solve the following system of $6$ nonlinear complex-valued equations in $6$ unknowns $a,b,c,d,e,f$, where $a,d,f \in \mathbb{R}$ and $b,c,e \in \mathbb{C}$: $$\begin{cases} a^2-|b|^2-|c|^2=1, \\ |b|^2-d^2-|e|^2=-1, \\ |c|^2-|e|^2-f^2=-1, \\ ab-bd-c\bar{e}=0, \\ \bar{b}c-de-ef=0, \\ \bar{c}a-\bar{e}\bar{b}-f\bar{c}=0, \end{cases}$$ where $a^2 \geq 1$. I wanted the solution to have a mix of complex and real values. After some brute force I actually found a particular solution: $$a=d= \pm{\sqrt{2}}, b= \pm{i}, c=e= 0,f=\pm{1}.$$ I was wondering if Mathematica using Solve could find other solutions. Here is the code that I used:

 Solve[a^2 - Abs[b]^2 - Abs[c]^2 ==
1 && Abs[b]^2 - d^2 - Abs[e]^2 ==-1 && Abs[c]^2 - Abs[e]^2 - f^2 == -1 &&
a b - b d - c e\[Conjugate] == 0 && b\[Conjugate] c - d e - e f == 0 &&
c\[Conjugate] a - e\[Conjugate] b\[Conjugate] - f c\[Conjugate] ==
0, {a, b, c, d, e, f}, ?]


My apologies, I still don't have the hang on how to enter Mathematica code here, even after keeping four spaces. My issue is what to put in "?" for the system to be solved.

• There are some syntax errors in here. Such as when multiplying variables, you have to put a space between them. Also, you can't have brackets around Abs[], you can just put Abs[]^2 and that should work. Commented Sep 7, 2016 at 19:18
• Square brackets are used for functions such as Abs[], round brackets are use for grouping such as (a+b)*c Commented Sep 7, 2016 at 19:28
• @J_Nat: I tried doing that, and then setting the domain to Complexes but to no avail. Commented Sep 7, 2016 at 19:30
• Complex domain is standard, try confining specifically the reals. Commented Sep 7, 2016 at 19:44
• As a strategy for approaching a new computer language, it is often a good idea to start simple and work your way towards complexity. For your case, how about choosing a 2 complex-variable problem with some of the smae features, and working your way up? Commented Sep 7, 2016 at 19:49

I would tackle this as follows

eqn = a^2 - Abs[b]^2 - Abs[c]^2 == 1 &&
Abs[b]^2 - d^2 - Abs[e]^2 == -1 && Abs[c]^2 - Abs[e]^2 - f^2 == -1 &&
a b - b d - c e\[Conjugate] == 0 &&
b\[Conjugate] c - d e - e f == 0 &&
c\[Conjugate] a - e\[Conjugate] b\[Conjugate] - f c\[Conjugate] == 0
(* a^2 - Abs[b]^2 - Abs[c]^2 ==
1 && -d^2 + Abs[b]^2 - Abs[e]^2 == -1 && -f^2 + Abs[c]^2 -
Abs[e]^2 == -1 &&
a b - b d - c Conjugate[e] == 0 && -d e - e f + c Conjugate[b] == 0 &&
a Conjugate[c] - f Conjugate[c] - Conjugate[b] Conjugate[e] == 0 *)


Define separate variables for the real and imaginary parts of those that are complex

subst = Thread[
Flatten[{Re /@ {b, c, e}, Im /@ {b, c, e}}] -> {rb, rc, re, ib, ic,
ie}]
(* {Re[b] -> rb, Re[c] -> rc, Re[e] -> re, Im[b] -> ib, Im[c] -> ic,
Im[e] -> ie} *)


Rewrite the equations as real expressions using these

eqn2 = ComplexExpand[(Re /@ eqn) && (Im /@ eqn), {b, c, e},
TargetFunctions -> {Re, Im}] /. subst
(* a^2 - ib^2 - ic^2 - rb^2 - rc^2 ==
1 && -d^2 + ib^2 - ie^2 + rb^2 - re^2 == -1 && -f^2 + ic^2 - ie^2 +
rc^2 - re^2 == -1 && -ic ie + a rb - d rb - rc re == 0 &&
ib ic + rb rc - d re - f re == 0 &&
ib ie + a rc - f rc - rb re == 0 &&
a ib - d ib + ie rc - ic re == 0 && -d ie - f ie + ic rb - ib rc ==
0 && -a ic + f ic + ie rb + ib re == 0 *)

vars = Flatten[{a, d, f, Re /@ {b, c, e}, Im /@ {b, c, e}}] /. subst
(* {a, d, f, rb, rc, re, ib, ic, ie} *)


I now find that Solve and Reduce struggle to solve these equations. The relevant expressions would be

(*Solve[eqn2,vars,Reals]*)
(*Solve[eqn2,vars,Reals]*)


Looking for a numerical solution seems to give a dense set of solutions, suggesting that we don't really have 9 independent equations. To solve the equations 100 times from random starting points, evaluate

Table[FindRoot[eqn2,
Transpose[{vars, RandomReal[{-1, 1}, Length[vars]]}],
MaxIterations -> 1000], {100}] // Chop


EDIT

There is a trap for the unwary here. If we don't specify the solution domain, Complex is assumed by default and we get incorrect answers. For example

NSolve[eqn2, vars]


returns 512 solutions, but most of them are complex.

NSolve[eqn2, vars, Reals]


finds only two solutions, for some reason. In comparison, FindRoot finds large numbers of apparently valid solutions.

• This looks quite complicated. Is there anything simpler? Commented Sep 7, 2016 at 21:03
• I think the only complicated part of it is the equations themselves. Commented Sep 7, 2016 at 21:22
• @MichaelE2 are you sure? NSolve[eqn2,vars] does return 512 solutions. However, almost all of these include complex values. NSolve[eqn2,vars,Reals] gives only two solutions However, FindRoot seems to give other genuine solutions. Commented Sep 8, 2016 at 19:10
• D'oh! Careless of me -- sorry. Commented Sep 8, 2016 at 19:33