General solutions of $ty''(t) -(t+1)y’(t) + y(t) = t^2$ given that $y_1(t)=e^t$ and $y_2(t)=t+1$ So I know the answer is $y(t)= c_1e^t + c_2(t+1) -t^2 -2t -2$
(According to answer attached to the question)
But what don’t understand is that I thought $-2t$ and $-2 $ shouldn’t be there because it’s same power as $c_2t$ and $c_2$.
I don’t really understand the theory behind this as my professor only taught the process.

Since that the ordinary differential equation is of order $2$, so the general solution for your problem is of the form $$\color{blue}{\boxed{\operatorname{solution-general}=\operatorname{homogeneous-solution}+\operatorname{particular-solution}}}$$ I suppose that the homogenous solution for your problem is $y_{1}(t)$ and $y_{2}(t)$,  and the particular solution you can find using $y_{1}(t)$ or $y_{2}(t)$ and the Abel's formula.  Asuming that the solution particular is $$y_{p}(t)=-t^{2}-2t-2$$
and that the homogenous solution is $$y_{h}(t)=c_{1}e^{t}+c_{2}(t+1), \quad c_{1},c_{2}\in \mathbb{R}$$
So, the general solution is $$y(t)=c_{1}e^{t}+c_{2}(t+1)-t^{2}-2t-2$$
Now, about your question, if you take $c_{1}=1$ and $c_{2}=-2$, so you have one solution for fixed values of the constants $$y(t)=e^{t}-2t-1-t^{2}-2t-1=e^{t}-t^{2}-4t-2$$
for that same reason you can fixed $c_{1}=0,1,2,3,\frac{1}{2},\ldots$ and $c_{2}=1,2,3,\frac{1}{2},\ldots$ and you can obtain more solutions  for  your problem.
It's important to see that $y(t)=c_{1}e^{t}+c_{2}(t+1)-t^{2}-2t-2$ contain a families of solutions for the ODE. For example here in Wolfram Mathematica you can see a nice simulating about this topic. Families of Solutions for ODEs.
