1
$\begingroup$

I am trying to solve an equation in Wolfram Mathematica and I get different results although the equation is technically the same. I am really confused. so basically:

$\sin(2x) - \cos(2x)= 1$ is the same as $\sin(2x) = 1 + \cos(2x)$.

For the first equation it gives me $x=\frac{1}{2}\left(2\pi n+\pi \right)$ and $x=\frac{1}{4}\left(4\pi n+\pi \right)$ as solution,

but for the second one it returns: $x=-\frac{3}{4}\pi n+\pi n$ and $x=-\frac{\pi }{2}+\pi n$. So which one is true and how should I exactly write the formula to show me the "correct" solution? I appreciate any help.

$\endgroup$
2
  • $\begingroup$ Try a few cases n=-2, -1,0,1,2 and see if the two solutions agree. $\endgroup$ Commented Dec 22, 2017 at 10:27
  • 1
    $\begingroup$ Please post your code and the answer you are getting. $\endgroup$
    – Sumit
    Commented Dec 22, 2017 at 11:08

3 Answers 3

4
$\begingroup$

Trying to reproduce your question I get same results in both cases

Solve[Sin[2 x] == 1 + Cos[2 x], x] == Solve[Sin[2 x] - Cos[2 x] == 1, x]
(* True*)

{{x -> ConditionalExpression[1/2 (\[Pi]/2 + 2 \[Pi] C[1]),C[1] \[Element] Integers]},
{x ->ConditionalExpression[1/2 (\[Pi] + 2 \[Pi] C[1]),C[1] \[Element] Integers]}}

The solutions are x=Pi/2+k Pi and x=Pi/4+l Pi , k,l Integers!

enter image description here

as expected!

$\endgroup$
3
$\begingroup$

The solutions are the same, just with different constants:

Reduce[1/2 (2 π n + π) == -(π/2) + π m]

(* m == 1 + n *)

and

Reduce[1/4 (4 π n + π) == -(3/4) π m + π m]

(* m == 1 + 4 n *)

For some reason, Mathematica rearranges the constants depending on the form of the equations you give it. But the solution sets are indeed identical.

$\endgroup$
0
$\begingroup$

Well, I don't think the results are technically different either (assuming n is an integer). To make it certain, you can define a branch (say, $0 \leq x \leq 2 \pi$) for your solution.

Solve[Sin[2 x] - Cos[2 x] == 1 && 0 <= x <= 2 Pi, x]
Solve[Sin[2 x] == 1 + Cos[2 x] && 0 <= x <= 2 Pi, x]

{{x -> π/4}, {x -> π/2}, {x -> (5 π)/4}, {x -> (3 π)/ 2}}

{{x -> π/4}, {x -> π/2}, {x -> (5 π)/4}, {x -> (3 π)/ 2}}

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.