used for factoring polynomials that contain the square of a first quantity minus the square of a second quantity. For example, the polynomial can be factored as follows: As a second example, the first two terms of can be factored as , so we have: Moreover, this formula can also be used for simplifying expressions: Complex number case: sum of two squares The difference of two squares is used to find the linear factors of the sum of two squares, using complex number coefficients. For example, the complex roots of can be found using difference of two squares: (since ) Therefore, the linear factors are and . Since the two factors found by this method are complex conjugates, we can use this in reverse as a method of multiplying a complex number to get a real number. This is used to get real denominators in complex fractions. Rationalising denominators The difference of two squares can also be used in the rationalising of irrational denominators. This is a method for removing surds from expressions (or at least moving them), applying to division by some combinations involving square roots. For example: The denominator of can be rationalised as follows: Here, the irrational denominator has been rationalised to . Mental arithmetic The difference of two squares can also be used as an arithmetical short cut. If two numbers (whose average is a number which is easily squared) are multiplied, the difference of two squares can be used to give you the product of the original two numbers. For example: Using the difference of two squares, can be restated as which is . Difference of two consecutive perfect squares The difference of two consecutive perfect squares is the sum of the two bases n and n+1. This can be seen as follows: Therefore, the difference of two consecutive perfect squares is an odd number. Similarly, the difference of two arbitrary perfect squares is calculated as follows: Therefore, the difference of two even perfect squares is a multiple of 4 and the difference of two odd perfect squares is a multiple of 8. Factorization of integers Several algorithms in number theory and cryptography use differences of squares to find factors of integers and detect composite numbers. A simple example is the Fermat factorization method, which considers the sequence of numbers , for . If one of the equals a perfect square , then is a