2

I got expressions that look like $$ \frac{1}{2} \mathrm e^{-\mathrm i r x} \left[\mathrm e^{2\mathrm i r x} \left(1 + \mathrm e^{-2\mathrm i x}\right)^r + \left(1 + \mathrm e^{2\mathrm i x}\right)^r\right] $$ and I want Mathematica to return $ 2^r\cos^rx $.

I tried Assumptions -> x > 0 && r > 0 and other things but nothing seems to give me this obvious answer. $x$ is a real number and $r$ is an integer.

user1830663
  • 165
  • 3

2 Answers2

3

A roundabout way at arriving at the result.

expr = 1/2 E^(-I r x) (E^(2 I r x) (1 + E^(-2 I x))^r + (1 + E^(2 I x))^r);

Calculating a sequence for integer values of r

seq = Table[expr // FullSimplify, {r, 1, 5}]

(* {2 Cos[x], 4 Cos[x]^2, 8 Cos[x]^3, 16 Cos[x]^4, 32 Cos[x]^5} *)

Using FindSequenceFunction to generalize from the sequence

expr2 = FindSequenceFunction[seq, r] // Simplify

(* 2^r Cos[x]^r *)

Verifying that the expressions are equal for integer r

Assuming[Element[r, Integers], expr == expr2 // FullSimplify]

(* True *)
Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198
1

Another kind of workaround:

expr = 1/2 E^(-I r x) (E^(2I r x) (1+E^(-2I x))^r+(1+E^(2I x))^r);

ExpToTrig[Simplify[Expand[expr] /. a_^(p_ q_) b_^p_ -> (a^q b)^p]]