# Simplify/Expand equation so that right side equals 0

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.

• Collect[x^2 + (x + 82)^2 - (x + 100)^2 == 0, x] Jul 20 at 19:42
• There's a typo in your (1) equation. The $x$ term is missing an $x$. It's just 36. Jul 20 at 19:44
• Thanks. I added the 'x'.
– mf67
Jul 20 at 20:01

f = Expand @* SubtractSides;

f[x^2 + (x + 82)^2 == (x + 100)^2]

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

TraditionalForm @ %


PolynomialForm[%%, TraditionalOrder -> True]


• 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) Jul 21 at 16:23

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] &)]

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