5
$\begingroup$

Given an equation like $$x^2 + (x + 82)^2 = (x + 100)^2,$$ how do I type to make this into $$x^2-36x-3276=0\; ?\tag{1}$$ This almost does it

x^2 + (x + 82)^2 == (x + 100)^2 // Simplify // Expand

but not completely. Naturally,

x^2 + (x + 82)^2 - (x + 100)^2 // Simplify // Expand

partially solves it, but can Mathematica construct the equation (1)? TIA.

$\endgroup$
3
  • $\begingroup$ Collect[x^2 + (x + 82)^2 - (x + 100)^2 == 0, x] $\endgroup$
    – Derek H
    Jul 20 at 19:42
  • 1
    $\begingroup$ There's a typo in your (1) equation. The $x$ term is missing an $x$. It's just 36. $\endgroup$
    – Derek H
    Jul 20 at 19:44
  • $\begingroup$ Thanks. I added the 'x'. $\endgroup$
    – mf67
    Jul 20 at 20:01
7
$\begingroup$
f = Expand @* SubtractSides;

f[x^2 + (x + 82)^2 == (x + 100)^2]
-3276 - 36 x + x^2 == 0
TraditionalForm @ %

enter image description here

PolynomialForm[%%, TraditionalOrder -> True]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Oooh, I wish I had known about SubtractSides before now! Very cool. (ApplySides[Expand,x^2 + (x + 82)^2 == (x + 100)^2]//SubtractSides also works) $\endgroup$
    – user1066
    Jul 21 at 16:23
3
$\begingroup$

This is a great example to use the ComplexityFunctionoption to Simplify and the undocumented PolynomialForm.

expr = x^2 + (x + 82)^2 == (x + 100)^2; 
Simplify[expr, ComplexityFunction -> (If[MatchQ[#1, _ == 0], 0, 1] &)]
PolynomialForm[%, TraditionalOrder -> True]

-3276 - 36 x + x^2 == 0

x^2 - 36 x - 3276 == 0

$\endgroup$
2
$\begingroup$

There are many ways of doing this, but I'd typically do it this way

expr = x^2 + (x + 82)^2 == (x + 100)^2;

# - Last[expr] & /@ %
(* x^2 + (82 + x)^2 - (100 + x)^2 == 0 *)
$\endgroup$

Your Answer

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

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