As you seem to have it, the triangular numbers are given by:
$$\triangle n=1+2+3+\dots+n$$
and the sum of triangular numbers:
$$T(n)=\triangle1+\triangle2+\triangle3+\dots+\triangle n$$
To verify your recurrence, we can consider differences by rearranging it as $T(n)-T(n-2)=n^2$ and substitute it in to get:
\begin{align}T(n)-T(n-2)&=\overbrace{\triangle1+\triangle2+\dots+\triangle(n-2)+\triangle(n-1)+\triangle n}^{T(n)}\\&-(\underbrace{\triangle1+\triangle2+\dots+\triangle(n-2)}_{T(n-2)})\\&=\triangle(n-1)+\triangle n\\&\stackrel?=n^2\end{align}
So we need to verify if we have:
$$\triangle(n-1)+\triangle n=n^2$$
This can be done once again by considering differences since it is clear that it holds for $n=1$, leaving us with:
$$\underbrace{\triangle(n-1)+\triangle n}_{n^2}-\underbrace{\triangle(n-2)-\triangle(n-1)}_{(n-1)^2}=n^2-(n-1)^2$$
These reduce down to:
\begin{align}\triangle n-\triangle(n-2)&=\overbrace{1+2+\dots+(n-2)+(n-1)+n}^{\triangle n}\\&-(\underbrace{1+2+\dots+(n-2)}_{\triangle(n-2)})\\&=(n-1)+n\\&=2n-1\\&=n^2-n^2+2n-1\\&=n^2-(n-1)^2\end{align}
which inductively verifies $\triangle(n-1)+\triangle n=n^2$, and hence $T(n)=T(n-2)+n^2$.
Note: It is likely the task wanted you to find a direct recurrence. There's a lot of work here to verify the recurrence, which is probably not expected. Often times you should simply try working it by hand. Then you may've realized that it's straightforward to compute it iteratively as follows:
function sum_of_triangles(n)
sum = 0
triangle = 0
for k in 1..n
triangle += k
sum += triangle
end
return sum
Writing this "purely" with recursively defined functions is fairly messy though if one does not have the formula for $\triangle n$ at hand. If one did, then this can be worked out as
function sum_of_triangles(n)
if n == 0
return 0
else
return sum_of_triangles(n-1) + triangle(n) // triangle(n) = n*(n+1)/2