# 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.$$

1. 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$$
2. 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}$$
3. 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$$

1. 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.

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.

• Oh that was neat! Apr 14, 2021 at 12:32
• Thank you everyone, I appreciated everyone's answer and I will vote @lutzlehmann up, since the answer was much more compact and a way to tackle the equation I did not thought about. Apr 15, 2021 at 7:03

Your answer is correct note that $$e^{-1/t+\ln t}= te^{-1/t}.$$ Notr that $$e^{ln z}=z$$.

Note Z Ahmed's answer; also, in the very last step, notice it is

$$5e^{-(\frac{1}{t}-\ln t-1)}.$$

• Right. thank you. Yet it is not right when I plug it back in the original equation. Apr 14, 2021 at 10:17
• @Dovendyr Maybe I'm missing something but I think it should work out when you plug it in. Can you say how it's wrong? Like how much is it off by? Apr 14, 2021 at 10:21
• Ok let me edit with pluggin in... just a sec :) Apr 14, 2021 at 10:21
• Sorry it seems right. But the webwork still refuses my answer. Apr 14, 2021 at 10:30

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.