I want to prove the expression $$1^2 + 2^2 + 3^2 + \cdots + n^2 = \dfrac{n(n+1)(2n+1)}{6}$$ by method of mathematical induction with Mathematica, but I do not know how to start. How do I tell Mathematica to do that?
Answer
f[n_] := (n (n + 1) (2 n + 1))/6
Easy. The proof by induction involves two steps:
Prove the relation for a starting value. We'll take n=1. So f[1] must equal 1^2:
f[1] == 1
True
Prove that, if the relation holds for a certain n, it also holds for n+1. In this case, for n+1 we have to add (n+1)^2 to the sum you get for n:
f[n] + (n + 1)^2 == f[n + 1]// FullSimplify
True
Comments
Post a Comment