TOPICS
Search

Difference of Squares


A difference of squares is an expression of the form a^2-b^2. It factors according to the algebraic identity

 a^2-b^2=(a-b)(a+b).

The algebraic identity holds in every commutative ring, and more generally whenever a and b commute.

An integer n is a difference of two integer squares iff n≢2  (mod4). Indeed, x^2-y^2=(x-y)(x+y) is a product of two integers having the same parity. Conversely, an odd integer n has the representation

 n=((n+1)/2)^2-((n-1)/2)^2,

while an integer divisible by 4 can be written 4k=(k+1)^2-(k-1)^2.


See also

Difference, Fermat's Factorization Method, Perfect Square, Sum and Difference of Cubes

Explore with Wolfram|Alpha

References

Gelfand, I. M. and Shen, A. Algebra. Boston, MA: Birkhäuser, 1993.Hardy, G. H. and Wright, E. M. An Introduction to the Theory of Numbers, 5th ed. Oxford, England: Clarendon Press, 1979.

Cite this as:

Weisstein, Eric W. "Difference of Squares." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/DifferenceofSquares.html

Subject classifications