(In reply to
by Happy)
You are on the right track. Prove it inductively (recursively), but do it with equations:
First define O(n) as the sum of the first n odd numbers
  n
O(n) = ∑(2i - 1)
i=1
Then show that
O(1) = 1 = 1²
O(2) = 1 + 3 = 4 = 2²
Now, assuming O(n) = n², show that O(n + 1) = (n + 1)²:
O(n + 1) = O(n) + [2(n + 1) - 1] = n² + 2n + 2 -1 = n² + 2n + 1 = (n + 1)²
|
Posted by TomM
on 2002-08-08 21:21:28 |