In mathematics, a square number or perfect square is an integer that is the square of an integer;^{[1]} in other words, it is the product of some integer with itself. For example, 9 is a square number, since it can be written as 3 × 3.
The usual notation for the square of a number n is not the product n × n, but the equivalent exponentiation n^{2}, usually pronounced as "n squared". The name square number comes from the name of the shape. The unit of area is defined as the area of a unit square (1 × 1). Hence, a square with side length n has area n^{2}.
Square numbers are non-negative. Another way of saying that a (non-negative) integer is a square number is that its square root is again an integer. For example, , so 9 is a square number.
A positive integer that has no perfect square divisors except 1 is called square-free.
For a non-negative integer n, the nth square number is n^{2}, with 0^{2} = 0 being the zeroth one. The concept of square can be extended to some other number systems. If rational numbers are included, then a square is the ratio of two square integers, and, conversely, the ratio of two square integers is a square, e.g., .
Starting with 1, there are ⌊⌋ square numbers up to and including m, where the expression ⌊x⌋ represents the floor of the number x.
Table[]
The following is list of numbers up to 100 and their squares.
All square numbers end with square digits (0, 1, 4 or 9).
n | n^{2} | n | n^{2} | n | n^{2} | n | n^{2} |
---|---|---|---|---|---|---|---|
1 | 1 | 31 | 961 | 61 | 3101 | 91 | 6X61 |
2 | 4 | 32 | X04 | 62 | 3204 | 92 | 7004 |
3 | 9 | 33 | X69 | 63 | 3309 | 93 | 7169 |
4 | 14 | 34 | E14 | 64 | 3414 | 94 | 7314 |
5 | 21 | 35 | E81 | 65 | 3521 | 95 | 7481 |
6 | 30 | 36 | 1030 | 66 | 3630 | 96 | 7630 |
7 | 41 | 37 | 10X1 | 67 | 3741 | 97 | 77X1 |
8 | 54 | 38 | 1154 | 68 | 3854 | 98 | 7954 |
9 | 69 | 39 | 1209 | 69 | 3969 | 99 | 7E09 |
X | 84 | 3X | 1284 | 6X | 3X84 | 9X | 8084 |
E | X1 | 3E | 1341 | 6E | 3EX1 | 9E | 8241 |
10 | 100 | 40 | 1400 | 70 | 4100 | X0 | 8400 |
11 | 121 | 41 | 1481 | 71 | 4221 | X1 | 8581 |
12 | 144 | 42 | 1544 | 72 | 4344 | X2 | 8744 |
13 | 169 | 43 | 1609 | 73 | 4469 | X3 | 8909 |
14 | 194 | 44 | 1694 | 74 | 4594 | X4 | 8X94 |
15 | 201 | 45 | 1761 | 75 | 4701 | X5 | 9061 |
16 | 230 | 46 | 1830 | 76 | 4830 | X6 | 9230 |
17 | 261 | 47 | 1901 | 77 | 4961 | X7 | 9401 |
18 | 294 | 48 | 1994 | 78 | 4X94 | X8 | 9594 |
19 | 309 | 49 | 1X69 | 79 | 5009 | X9 | 9769 |
1X | 344 | 4X | 1E44 | 7X | 5144 | XX | 9944 |
1E | 381 | 4E | 2021 | 7E | 5281 | XE | 9E21 |
20 | 400 | 50 | 2100 | 80 | 5400 | E0 | X100 |
21 | 441 | 51 | 21X1 | 81 | 5541 | E1 | X2X1 |
22 | 484 | 52 | 2284 | 82 | 5684 | E2 | X484 |
23 | 509 | 53 | 2369 | 83 | 5809 | E3 | X669 |
24 | 554 | 54 | 2454 | 84 | 5954 | E4 | X854 |
25 | 5X1 | 55 | 2541 | 85 | 5XX1 | E5 | XX41 |
26 | 630 | 56 | 2630 | 86 | 6030 | E6 | E030 |
27 | 681 | 57 | 2721 | 87 | 6181 | E7 | E221 |
28 | 714 | 58 | 2814 | 88 | 6314 | E8 | E414 |
29 | 769 | 59 | 2909 | 89 | 6469 | E9 | E609 |
2X | 804 | 5X | 2X04 | 8X | 6604 | EX | E804 |
2E | 861 | 5E | 2E01 | 8E | 6761 | EE | EX01 |
30 | 900 | 60 | 3000 | 90 | 6900 | 100 | 10000 |
Properties[]
The number m is a square number if and only if one can arrange m points in a square:
The expression for the Template:Mvarth square number is Template:Math. This is also equal to the sum of the first Template:Mvar odd numbers as can be seen in the above pictures, where a square results from the previous one by adding an odd number of points (shown in magenta). The formula follows:
So for example, 5^{2} = 21 = 1 + 3 + 5 + 7 + 9.
There are several recursive methods for computing square numbers. For example, the nth square number can be computed from the previous square by n^{2} = (n − 1)^{2} + (n − 1) + n = (n − 1)^{2} + (2n − 1). Alternatively, the Template:Mvarth square number can be calculated from the previous two by doubling the Template:Mathth square, subtracting the Template:Mathth square number, and adding 2, because n^{2} = 2(n − 1)^{2} − (n − 2)^{2} + 2. For example,
- 2 × 5^{2} − 4^{2} + 2 = 2 × 21 − 14 + 2 = 42 − 14 + 2 = 30 = 6^{2}
One number less than a square (m - 1) is always the product of
- 1 and
+ 1 (e.g. 8 × 6 equals 40, while 7^{2} equals 41). Thus, 3 is the only prime number one less than a square.
A square number is also the sum of two consecutive triangular numbers. The sum of two consecutive square numbers is a centered square number. Every odd square is also a centered octagonal number.
Another property of a square number is that (except 0) it has an odd number of positive divisors, while other natural numbers have an even number of positive divisors. An integer root is the only divisor that pairs up with itself to yield the square number, while other divisors come in pairs.
Lagrange's four-square theorem states that any positive integer can be written as the sum of four or fewer perfect squares. Three squares are not sufficient for numbers of the form Template:Math. A positive integer can be represented as a sum of two squares precisely if its prime factorization contains no odd powers of primes of the form Template:Math. This is generalized by Waring's problem.
A square number can end only with square digits (like the case of the prime numbers, a prime number can end only with prime digits or 1), i.e. 0, 1, 4 or 9, as follows:
- if a number is divisible both by 2 and by 3 (i.e. divisible by 6), its square ends in 0, and only 0, 3 can precede it (also, the number form by the preceding digits, divided by 3, is also a square number) (if ending with 00, then the preceding digits must also form a square number, and if ending with 30, then the preceding digits must form a Pronic number);
- if a number is divisible neither by 2 nor by 3, its square ends in 1, and only even numbers can precede it (i.e. the number form by the preceding digits must be even) (also, a half of the number form by the preceding digits is a generalized pentagonal number, i.e. the exponents in the right hand side of , these numbers can be used to calculate , the number of partitions of n: ), and , the sum of divisors of n: using the same equation, but if the last term is , then we change it to n instead of 0 or 1.
- if a number is divisible by 2, but not by 3, its square ends in 4, and only 0, 1, 4, 5, 8, 9 can precede it (i.e. the number form by the preceding digits must be = 0 or 1 mod 4) (also, the number form by the preceding digits is a generalized octagonal number);
- if a number is not divisible by 2, but by 3, its square ends in 9, and only 0, 6 can precede it (i.e. the number form by the preceding digits must be divisible by 6) (also, the number form by the preceding digits, divided by 6, is a triangular number, thus the number form by the preceding digits, added by 1, is a centered hexagonal number (or a hex number), they are differences of two consecutive cubes).
Also....
- If we write a square number, and write digits "00" after this number, then we get a square number.
- If we write a Pronic number, and write digits "30" after this number, then we get a square number.
- If we write a number which is 3 times a square number, and write a digit "0" after this number, then we get a square number.
- If we write a number which is twice a generalized pentagonal number, and write a digit "1" after this number, then we get a square number.
- If we write a generalized octagonal number, and write a digit "4" after this number, then we get a square number.
- If we write a number which is 6 times a triangular number, and write a digit "9" after this number, then we get a square number.
Similar rules can be given for other bases, or for earlier digits (the dozens digit instead of the units digit, for example). All such rules can be proved by checking a fixed number of cases and using modular arithmetic.
In general, if a prime p divides a square number m then the square of p must also divide m; if p fails to divide m/p, then m is definitely not square. Repeating the divisions of the previous sentence, one concludes that every prime must divide a given perfect square an even number of times (including possibly 0 times). Thus, the number m is a square number if and only if, in its canonical representation, all exponents are even.
Squarity testing can be used as alternative way in factorization of large numbers. Instead of testing for divisibility, test for squarity: for given m and some number k, if is the square of an integer n then k − n divides m. (This is an application of the factorization of a difference of two squares.) For example, 100^{2} − EEE3 is the square of 3, so consequently 100 − 3 divides EEE3. This test is deterministic for odd divisors in the range from k − n to k + n where k covers some range of natural numbers .
A square number cannot be a perfect number.
The sum of the n first square numbers is
The first values of these sums, the square pyramidal numbers, are:
0, 1, 5, 12, 26, 47, 77, E8, 150, 1E9, 281, 362, 462, 583, 707, 874, X48, 1049, 1279, 151X, 17E2, 1XEE, 2243, 2604, 2X04
The sum of the first odd integers, beginning with one, is a perfect square. 1, 1 + 3, 1 + 3 + 5, 1 + 3 + 5 + 7, etc.
The sum of the n first cubes is the square of the sum of the n first positive integers; this is Nicomachus's theorem.
All fourth powers, sixth powers, eighth powers and so on are perfect squares.
Special cases[]
- If the number is of the form m6 where m represents the preceding digits, its square is n30 where n = m(m + 1) and represents digits before 30. For example, the square of 86 can be calculated by n = 8 × (8 + 1) = 60 which makes the square equal to 6030.
- If the number is of the form m0 where m represents the preceding digits, its square is n00 where n = m^{2}. For example, the square of 70 is 4100.
- If the number has two digits and is of the form 6m where m represents the units digit, its square is 3mdd where dd = m^{2}. Example: To calculate the square of 68, it is 3, 8, 8^{2} = 54, which means 68^{2} = 3854.
- If the number ends in 4, its square will end in 4; similarly for ending in 54, 854, 3854, ..., 2E21E61E3854, etc. If the number ends in 9, its square will end in 9, similarly for ending in 69, 369, 8369, ..., 909X05X08369. For example, the square of 75369 is 4745E22369, both ending in 369. (The numbers 4, 9, 54, 69, etc. are called automorphic numbers)
Except 0, 1 and 100, square numbers cannot be Fibonacci numbers. (note that these three numbers except 0 are exactly the only two Lucas numbers which are square numbers written in binary (base 2))
Except 1 and 4, square numbers cannot be Lucas numbers.
Except 1, square numbers cannot be repunits.
Except single-digit square numbers (0, 1, 4 and 9), square numbers cannot be repdigits.
Except 0, square numbers cannot be pronic numbers.
Except 0, 1 and 2X04, square numbers cannot be square pyramidal numbers.
Note that both of 21 and 201 are square numbers, are there any other square numbers of the form 2{0}1 (=2000...0001)?
Odd and even square numbers[]
Squares of even numbers are even (and in fact divisible by 4), since (2n)^{2} = 4n^{2}.
Squares of odd numbers are odd, since (2n + 1)^{2} = 4(n^{2} + n) + 1.
It follows that square roots of even square numbers are even, and square roots of odd square numbers are odd.
As all even square numbers are divisible by 4 (in fact, end with 0 or 4, a square cannot end with 8), the even numbers of the form 4n + 2 (i.e. end with 2, 6 or X) are not square numbers.
As all odd square numbers are of the form 4n + 1 (in fact, end with 1 or 9, a square cannot end with 5), the odd numbers of the form 4n + 3 (i.e. end with 3, 7 or E) are not square numbers.
All odd square numbers are of the form 8n + 1, since (2n + 1)^{2} = 4n(n + 1) + 1 and n(n + 1) is an even number. (thus, the dozens digit of an odd square number is even, this is because the units digit of an odd square number is either 1 or 9)
Every odd perfect square is a centered octagonal number (centered 8-gonal number). The difference between any two odd perfect squares is a multiple of 8. The difference between 1 and any higher odd perfect square always is eight times a triangular number, while the difference between 9 and any higher odd perfect square is eight times a triangular number minus eight. Since all triangular numbers have an odd factor, but no two values of 2^{n} differ by an amount containing an odd factor, the only perfect square of the form 2^{n} − 1 is 1, and the only perfect square of the form 2^{n} + 1 is 9.
- ↑ Some authors also call squares of rational numbers perfect squares.