# Solving complex equations with variable exponents

How would I go about solving

$(1+i)^n = (1+\sqrt{3}i)^m$ for integer $m$ and $n$?

I have tried

Solve[(1+I)^n == (1+Sqrt[3] I)^m && n ∈ Integers && m ∈ Integers, {n, m}]


but this does not give the answer in the 'correct' form.

• You have two unknowns and one equation, is there a solution for both n and m? Jan 18, 2016 at 9:00
• I don't think Mathematica can solve this directly, when written in this form. But this should give a hint about the solution: Table[Through[{Re, Im}[(1 + I)^n]], {n, 0, 50, 4}] and Table[Through[{Re, Im}[(1 + Sqrt[3] I)^m]], {m, 0, 50, 3}]. (n==24 && m==12 is one possible solution.) Jan 18, 2016 at 9:05
• @JasonB Actually, there are two equations, one for the amplitudes and the other for the phases. Jan 18, 2016 at 9:09

As stated in the question and also the comment above by Szabolcs, Mathematica does not seem to be able to solve the equation directly. For instance, neither Solve nor Reduce produces the desired result. However, as I suggested in a comment above, the equation can be decomposed into expressions for its amplitude and phase, and each solved to obtain the answer. Begin with the amplitude.

Abs[(1 + I)]^n == Abs[(1 + Sqrt[3] I)]^m
(* 2^(n/2) == 2^m *)


Thus, n is twice m. Insert this into the expression for the phases, modulo 2 π.

Solve[(Mod[Arg[(1 + I)] n, 2 π] ==
Mod[Arg[(1 + Sqrt[3] I)] m, 2 π]) /. n -> 2 m, m, Integers]
(* {{m -> ConditionalExpression[12 C[1], C[1] ∈ Integers]}} *)


This, m is any integer, positive or negative, multiplied by 12, and n is 2 m.

• Thanks! Interesting how this seems to be the only way without resorting to a brute force search (see the other answers). I was thinking there would be a more elegant way. Jan 18, 2016 at 11:40

One can get a truly ridiculous solution by ComplexExpand[]ing the real and imaginary parts:

Reduce[ComplexExpand[{Re /@ #, Im /@ #}] &[
(1 + I)^n == (1 + Sqrt[3] I)^m],
{m, n}, Integers]
(*  ... an astonishing mess involving 14 integer parameters ... *)


However, pulling out the magnitude and argument is much nicer.

Reduce[ComplexExpand[{Abs /@ #, Arg /@ #}] &[
(1 + I)^n == (1 + Sqrt[3] I)^m],
{m, n}, Integers]
(* C[1] ∈ Integers && m == 12 C[1] && n == 24 C[1] *)


• That's the way how to solve such equations! +1:)
– user36273
Jan 19, 2016 at 13:07
Last@Reap@Do[
If[
ReIm[(1 + I)^n] == ReIm[(1 + Sqrt[3] I)^m]
, Sow[{n, m}]
]
, {n, 100}
, {m, 100}
]

{{{24, 12}, {48, 24}, {72, 36}, {96, 48}}}