(potentially non-trivial) factorization of . This trick can be generalized as follows. If mod and mod , then is composite with non-trivial factors and . This forms the basis of several factorization algorithms (such as the quadratic sieve) and can be combined with the Fermat primality test to give the stronger Miller–Rabin primality test. Generalizations The identity also holds in inner product spaces over the field of real numbers, such as for dot product of Euclidean vectors: The proof is identical. For the special case that and have equal norms (which means that their dot squares are equal), this demonstrates analytically the fact that two diagonals of a rhombus are perpendicular. This follows from the left side of the equation being equal to zero, requiring the right side to equal zero as well, and so the vector sum of (the long diagonal of the rhombus) dotted with the vector difference (the short diagonal of the rhombus) must equal zero, which indicates the diagonals are perpendicular. Difference of two nth powers If a and b are two elements of a commutative ring R, then . History Historically, the Babylonians used the difference of two squares to calculate multiplications. For example: 93 x 87 = 90² - 3² = 8091 64 x 56 = 60² - 4² = 3584 See also Congruum, the shared difference of three squares in arithmetic progression Conjugate (algebra) Factorization Notes References External links difference of two squares at mathpages.com Elementary algebra Commutative algebra Mathematical identities Articles containing proofs Subtraction