# Do not understand the result I'm getting from Solve [closed]

I did

Solve[k2 Cos[x] - k1 Sin[x] == 0,x]


Since tangent is sin over cos, the solution must be

arctan(k2/k1)


But Mathematica gives

{{x ->
ConditionalExpression[
ArcTan[-(k1/Sqrt[k1^2 + k2^2]), -(k2/Sqrt[k1^2 + k2^2])] + 2*Pi*C[1],
Element[C[1], Integers]]},
{x ->
ConditionalExpression[
ArcTan[k1/Sqrt[k1^2 + k2^2], k2/Sqrt[k1^2 + k2^2]] + 2*Pi*C[1],
Element[C[1], Integers]]}}


Why is this the case?

## closed as off-topic by m_goldberg, MarcoB, user9660, dr.blochwave, EdmundMay 31 '16 at 9:08

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

• "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." – m_goldberg, MarcoB, Community, dr.blochwave, Edmund
If this question can be reworded to fit the rules in the help center, please edit the question.

• Try simplifying this expression assuming k1 and k2 are Reals. – swish May 30 '16 at 20:59
• Consider that Mathematica assumes all numbers to be complex unless told otherwise. Consider the result of FullSimplify[Solve[{k2 Cos[x] - k1 Sin[x] == 0}, x], {k1, k2, x} \[Element] Reals] instead. – MarcoB May 30 '16 at 21:00
• It is exactly what you are expecting, written in a different way. ArcTan[x,y] is ArcTan[y/x] with proper choice of sign. Check this for details. – Sumit May 30 '16 at 21:02
• @MarcoB Thank you very much! By the way, I won't have any situation where I consider variables that are not real. Can I just make assumption that all variables are reals globally? – user42459 May 30 '16 at 21:10
• Assuming[{{k1, k2} \[Element] Reals}, Simplify[Solve[k2 Cos[x] - k1 Sin[x] == 0, x]]] . you will still have a condition because it is not specified that we are looking for Principal values (That is the solution + 2Pi C[1] part). – Sumit May 30 '16 at 21:14

To remove the condition just assume the condition

soln1 = Solve[k2 Cos[x] - k1 Sin[x] == 0, x] //
Simplify[#, Element[C[1], Integers]] &


To look at the fundamental interval, set the arbitrary integer constant to zero

soln2 = Solve[k2 Cos[x] - k1 Sin[x] == 0, x] /. C[1] -> 0


Plot3D[Evaluate[x /. soln2],
{k1, -10, 10}, {k2, -10, 10},
PlotLegends -> "Expressions",
PlotPoints -> 50]


Simplifying the results

soln3 = soln2 // FullSimplify[#, Element[{k1, k23}, Reals]] &


Despite its appearance, the first function is real-valued, e.g.,

x /. soln3 /. {k1 -> 1, k2 -> 3} // FunctionExpand


Plot3D[Evaluate[x /. soln3],
{k1, -10, 10}, {k2, -10, 10},
PlotLegends -> "Expressions",
PlotPoints -> 50]