I tried to run the codes

$Assumptions = {a, b, c, d, q} \[Element] Reals
a = Sqrt[1 - c^2 Sin[q]^2];
d = -Sqrt[1 - b^2 Csc[q]^2];
Solve[-a b - c d Sin[q]^2 == 0, b]

and the output is

{{b -> -c Sin[q]^2}, {b -> c Sin[q]^2}}

Only one of the "solutions" is the right answer, the second one. Why did it include the first one, the wrong solution? How do I make it only give the correct one?

  • 2
    $\begingroup$ It seems to me you are making assumptions about your variables that you know, but have not given to Mathematica (everything is assumed to be complex-valued unless indicated otherwise). Mathematica is not a mind reader. $\endgroup$ Oct 13, 2018 at 13:02
  • $\begingroup$ @J.M. I just added the assumption for all variables to be real, {a,b,c,d,q} and it still give the same output. Am I missing something? $\endgroup$ Oct 13, 2018 at 13:11
  • $\begingroup$ What does Solve[b Sqrt[1 - c^2 Sin[q]^2] - Sqrt[1 - b^2 Csc[q]^2] c Sin[q]^2 == 0, b, Reals] give for you? $\endgroup$ Oct 13, 2018 at 13:15
  • $\begingroup$ @J.M. It gives two solutions with ConditionalExpression. It's a bit messy. $\endgroup$ Oct 13, 2018 at 13:20
  • 3
    $\begingroup$ @Bao - I get {{b -> ConditionalExpression[c Sin[q]^2, c < 0 && -1 < c Sin[q] < 1]}, {b -> ConditionalExpression[c Sin[q]^2, c > 0 && -1 < c Sin[q] < 1]}}. You probably need to Clear your variables or start with a fresh kernel. $\endgroup$
    – Bob Hanlon
    Oct 13, 2018 at 15:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.