Since we have two different situations, let's break down this into two different statements, #tau_1# and #tau_2#, respectively.
#tau_1(n):1+2xx2^2+3^2+...+2xx(n-1)^2+n^2=n^2(n+1)/2#
if #n# is odd and
#tau_2(n):1+2xx2^2+3^2+...+(n-1)^2+2xxn^2=n(n+1)^2/2#
if #n# is even.
Let's prove #tau_1#, firstly. The base case, #tau_1(1)#, claims that
#1=1^2(1+1)/2 -= "True"#.
Now, let #x# be an odd integer such that #tau_1(x)# is true.
#:. color(red)(1+2xx2^2+3^2+...+2xx(x-1)^2+x^2=x^2(x+1)/2)=S_x#
We must prove if the next case holds. However, the next case is not #tau_1(x+1)#. This is becaused we defined #tau_1# only on odd positive integers. This means that the next case is actually #tau_1(x+2)#, as #x+2# is odd.
#tau_1(x+2):color(red)(1+2xx2^2+...+2xx(x-1)^2+x^2)+2xx(x+1)^2+(x+2)^2=(x+2)^2(x+3)/2=S_(x+2)#
Notice how the part highlighted in red is the former sum, #S_x#.
We know that
#S_x =x^2(x+1)/2#
So by substituting this into the statement, we get
#color(red)(x^2(x+1)/2)+2xx(x+1)^2+(x+2)^2 = (x+2)^2(x+3)/2#
This is fairly easy to find. Multiply both sides by #2#, expand all squares and multiply the parantheses (or, in other words, do it directly) to get the following result:
#x^3+7x^2+16x+12 = x^3+7x^2+16x+12#
Which is true. Thus, by mathematical induction, #tau_1(n)# is true for all odd integers #n#.
The second statement, #tau_2#, is similar. Check the base case #tau_2(2)#, assume it is true for some even whole number #y# then check it for the next even number, #y+2#.
If you do all that, you will find that #tau_2(n)# is true for #n# even.
Hence, by Mathematical induction, the statement
#S_n :#
#{(1+2xx2^2+...+2xx(n-1)^2+n^2=n^2(n+1)/2", if n is odd"),(1+2xx2^2+...(n-1)^2+2xxn^2 = n(n+1)^2/2", if n is even"):}#
is true for all #n# who follow all the respective conditions.