Let P(n) be the given statement.
P(n)=12+22+32+⋯+n2=n(n+1)(2n+1)6
By principle of mathematical induction, let the statement is true for n=1.
P(1)=12=1(1+1)(2(1)+1)6
1=1
So, the statement is true for n=1.
Let the statement is true for n=k, then,
P(k)=12+22+32+⋯+k2=k(k+1)(2k+1)6 (1)
For n=k+1,
12+22+32+⋯+(k+1)2=(k+1)(k+2)(2k+3)6 (2)
The left hand side of the above equation can be written as,
12+22+32+⋯+k2+(k+1)2
From equation (1),
12+22+32+⋯+k2+(k+1)2=k(k+1)(2k+1)6+(k+1)2
=k(k+1)(2k+1)+6(k+1)26
=(k+1)(k(2k+1)+6(k+1))6
=(k+1)(2k2+7k+6)6
=(k+1)(k+2)(2k+3)6
This is equal to the left hand side of the equation (2).
Therefore, by the principle of mathematical induction, the given statement is true for every real number.