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.


closed as off-topic by Sektor, Henrik Schumacher, m_goldberg, Daniel Lichtblau, Michael E2 Dec 22 '17 at 20:01

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Henrik Schumacher, m_goldberg, Michael E2
  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Sektor, Daniel Lichtblau
If this question can be reworded to fit the rules in the help center, please edit the question.

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

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!


The solutions are the same, just with different constants:

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

(* m == 1 + n *)


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.


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}}


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