<s>[INST] Find value of $a_1$ such that $a_{101}=5075$ Let $\{a_n\}$ be a sequence of real numbers where $$a_{n+1}=n^2-a_n,\, n=\{1,2,3,...\}$$
Find value of $a_1$ such that $a_{101}=5075$.

I have 
$$a_2=1^2-a_1$$
$$a_3=2^2-a_2=2^2-1^2+a_1$$
$$a_4=3^2-2^2+1^2-a_1$$
$$a_5=4^2-3^2+2^2-1^2+a_1$$
$$\vdots$$
$$a_{101}=100^2-99^2+98^2-97^2+\ldots+2^2-1^2+a_1.$$
Therefore, $$a_{101}=\sum_{i=1}^{50}(2i)^2-\sum_{i=1}^{50}(2i-1)^2.$$
Thus, $$5075=\sum_{i=1}^{50}(4i^2-4i^2+4i-1)+a_1,$$
and, $$a_1=5075-4\sum_{i=1}^{50}(i)+\sum_{i=1}^{50}(1).$$
Hence, $$a_1=5075-4(\frac{50}{2})(51)+50=25,$$
and $a_1=25$.
Is it correct? Do you have another way? Please check my solution, thank you.
 [/INST] In the most simple way:
$$A_{n+1}+A_n=n^2~~~(1)$$ is a non-homogeneous recurrence equation. Its homogeneous part
$$A_{n+1}+A_n=0 \implies A_{n+1}=-A_n \implies A_n= (-1)^n S~~~(2)$$ In the RHS of (1) being $n^2)$, we can take $A_n =P n^2+Q n+R$; inserting this in (1), we get
$2P=1,P+Q=0,P+Q+2R=0 \implies P=1/2, Q=1/2, R=0.$ Then the total finally solution of (1) is
$$A_n=\frac{n(n-1)}{2}+ (-1)^n S. $$  Given that $A_{101}=5075$, finally we get
$$A_n=\frac{n(n-1)}{2}+(-1)^{n+1}~ 25.$$
</s>