I have been trying to simplify equations using Mathematica of the following basic form: $$\text{FullSimplify}\left[x^2+y^2,\text{Assumptions}\to x^2+y^2==c^2\right]$$ With the output being, $$x^2+y^2$$

FullSimplify[x^2 + y^2, Assumptions -> x^2 + y^2 == c^2]

However, if $c$ were a number, the expected result is obtained ie. $c^{2}$. I would like to know how to make Mathematica replace the more complex(as per Leaf count) LHS with the simpler RHS.

  • 2
    $\begingroup$ Convert the assumption to a replacement rule, e.g., expr /. y^2 :> c^2 - x^2 $\endgroup$
    – Bob Hanlon
    Jan 27, 2022 at 17:27
  • $\begingroup$ My example was a representative of the complex. In general, I'm not sure how this will work. For example, say I have $ab+cd==ef+gh$. Then, I would expect $ab+cd$ to remain unchanged. However, say if it were $ab+cd+ef==gh$, then I would expect $ab+cd+ef$ to be replaced. $\endgroup$ Jan 27, 2022 at 17:31
  • $\begingroup$ @Gattu A replacement will work for the example you gave. Perhaps you could show a more representative example. Maybe you could use an intermediate value: Simplify[x^2 + y^2, Assumptions -> x^2 + y^2 == m] returns m and then you could replace m with c^2 in the resulting expression. $\endgroup$
    – MarcoB
    Jan 27, 2022 at 18:18
  • 1
    $\begingroup$ Alternatively, use the rule as a replacement-function for the TransformationFunction option like so: FullSimplify[x^2+y^2,TransformationFunctions->{(#/.(x^2+y^2)->c^2)&}] $\endgroup$ Jan 27, 2022 at 20:29
  • $\begingroup$ @MarcoB's solution is explained, somewhat, here $\endgroup$
    – Michael E2
    Feb 8, 2022 at 21:42


Browse other questions tagged or ask your own question.