Solving ODE with initial condition, one step wrong I have a step wrong while solving my IVP but I cannot find what. I will post my detailed solution in the hope someone sees where it goes awry:
The IVP: $$t^2 \frac{dy}{dt}−t=1+y+ty,y(1)=4.$$

*

*I start by moving all function of y on the RHS:
$$\displaystyle$$
$$\displaystyle t^2\frac{dy}{dt}-y-ty=1 +t$$
$$t^2\frac{dy}{dt}-(1+t)y=1 +t$$

*It is not in standard form so I continue by divinding by $t^2$:
$$\frac{dy}{dt}-\frac{(1+t)}{t^2}y=\frac{1 +t}{t^2}$$

*With $h(t) = -\frac{(1+t)}{t^2}$ I can use integrating factor $e^{\int h(t)}$ = $e^{H(t)}$. With $H(t) = \frac{1}{t} - ln(t)$, I get :

$$e^{\frac{1}{t} - ln(t)}\frac{dy}{dt}- e^{\frac{1}{t} - ln(t)}\frac{(1+t)}{t^2}y=\frac{1 +t}{t^2}e^{\frac{1}{t} - ln(t)}$$
Which can be rewritten as:
$$\frac{d}{dt}(e^{\frac{1}{t} - ln(t)} y) = \frac{1 +t}{t^2}e^{\frac{1}{t} - ln(t)}$$
$$\displaystyle e^{\frac{1}{t} - ln(t)} y = \int{ \frac{1 +t}{t^2}e^{\frac{1}{t} - ln(t)}} $$
$$\displaystyle e^{\frac{1}{t} - ln(t)} y =  -e^{\frac{1}{t} - ln(t)} + C $$
4. by multiplying with $e^-H(t)= e^{-\left(\frac{1}{t} - ln(t)\right)}$ we get:
$$ y(1) = 4 =  -1 + Ce^{-\left(\frac{1}{t} - ln(t)\right)} \\
C = 5e$$


*The initial value condition gives that C:

$$y(1) = 4 =  -1 + Ce^{-\left(\frac{1}{t} - ln(t)\right)} \\
C = 5e$$
$$y(t) = -1 + 5 e e^{-\left(\frac{1}{t} - ln(t)\right)}  \\ 
y(t) = -1 + 5 e^{-\left(\frac{1}{t} - ln(t) - 1\right)}$$
But this appears to be wrong. Is there some step I am doing wrong?
EDIT: fixed -1 in exponent as per the comments.
EDIT 2: trying to plug in in the original equation
Simplifying we get:
$$y(t) = -1 + 5 t e^{1-\frac{1}{t}}\\
y'(t) =  5  e^{1-\frac{1}{t}} + 5t \frac{1}{t^2}e^{1-\frac{1}{t}} \\
y'(t) =  5  e^{1-\frac{1}{t}} + 5 \frac{1}{t}e^{1-\frac{1}{t}}$$
$$t^2 \frac{dy}{dt}−t=1+y+ty \\
t^2 \left(5  e^{1-\frac{1}{t}} + 5t \frac{1}{t}e^{1-\frac{1}{t}} \right) -t = 1 -1 + 5 t e^{1-\frac{1}{t}}  -t + 5 t^2 e^{1-\frac{1}{t}} $$
Seems everything is disappearing, but I still get wrong on the automatic assessment.
 A: Your answer is correct note that $$e^{-1/t+\ln t}= te^{-1/t}.$$
Notr that $e^{ln z}=z$.
A: Isolate the derivative on the left side
$$
t^2y'=1+t+y+yt=(1+t)(1+y).
$$
This is a separable first order DE, so that
$$
\ln(1+y)=\int\frac{dy}{1+y}=\int\frac{(1+t)dt}{t^2}=-\frac1t+\ln(t)+c
\\~\\
(1+y)=Cte^{-1/t}.
$$
Etc.
A: Note Z Ahmed's answer; also, in the very last step, notice it is
$$5e^{-(\frac{1}{t}-\ln t-1)}.$$
A: Note that:
\begin{align*}
t^{2}\frac{dy}{dt} - t =1+y+ty \Leftrightarrow \frac{dy}{dt} = \frac{1}{t^{2}} + \frac{1}{t^2}y+\frac{1}{t}y+\frac{1}{t} = y(\frac{1}{t^2}+\frac{1}{t})+(\frac{1}{t^2}+\frac{1}{t})
\end{align*}
Which is a linear equation. Solving this equation you conclude:
\begin{equation*}
y(t) = Ce^{-\frac{1}{t}}t - 1 \hspace{1cm}, C \in\mathbb{R}
\end{equation*}
Knowing that $y(1)=4$ you get:
\begin{equation*}
y(1) = 4 \Leftrightarrow C\frac{1}{e}-1 = 4 \Leftrightarrow C = 5e
\end{equation*}
Finally, you have:
\begin{equation*}
y(t) = 5e^{1-\frac{1}{t}}t-1 = 5e^{\frac{t-1}{t}}t-1
\end{equation*}
Which verifies the inicial equation.
