Thursday, 24 May 2012

Is the difference of two squares always composite?

Someone arrived here via this google search - briefly, the difference between X^2 and Y^2 is always a composite number (where X and Y are positive integers) if the difference between X and Y is greater than 1. The reason for this becomes apparent when you look at this way of working out the difference between X and Y.

If the difference is 1, to get from X^2 to Y^2 you add X + (X+1). This will be an odd number and can be prime or composite (every odd number can be expressed as the difference between two consecutive squares.)

If it is 2, you add X + (X+1) + (X+1) + (X+2). This can be rewritten as 4(X+1)

If it is 3 you add X + (X+1) + (X+1) + (X+2) + (X+2) + (X+3). This can be rewritten as 6(X + 1.5) = 3 (2X+3)

If you continue in this way it is clear that where the difference is greater than 1, the sequence of numbers can always be rewritten as an equation that is a composite integer.

Another way of thinking about this: the difference between two squares is always the sum of a series of consecutive odd numbers. For instance to get from 25 to 64, you add 11 (=5+6) then 13 (= 6+7) then 15 (=7+8). If there is an odd number of these, then the sum will be (the quantity of odd numbers in the series) x (the middle number in the series). If there is an even number, then the sum will be (the quantity of odd numbers in the series) x (the average of the middle two numbers in the series). This latter term will be N+1/2 but since you are multiplying by an even number the total is a composite.

Hope that all makes sense. This is the basis of Fermat factorisation, which I have talked about elsewhere.

No comments:

Post a Comment