Prove that
(a) \[1^2 + 2^2 + 3^2 + \dots + n^2 = \frac{1}{6} n (n+1)(2n+1)\]
(b) \[1^2 + 3^2 + 5^2 + \dots + (2n-1)^2 = \frac{1}{3} n (2n-1)(2n+1).\]