Solve the following differential equation: $ty' + 2y = \sin(t)$ An exercise from the book:

Solve the following differential equation: $ty' + 2y = \sin(t)$

This is the first time I approch a differential equation, and the book doesn't provide an example how to solve an differential equation,
So I need your help to show me how to solve this differential equation.
It's not a homework. Thanks in advance!

The usual approach for an equation like this is to rewrite slightly, and then find an integrating factor:
$$y' + \frac 2 t y = \frac{\sin t}{t}$$
We want to find a function $\mu$ so that the left hand side can be written as a single derivative; to this end, multiply through by $\mu$ to get
$$\mu y' + \frac {2 \mu}{t} y= \mu \frac{\sin t}{t}$$
Now notice that the left hand side looks like product rule, if only we could write
$$\mu y' + \frac{2\mu}{t} y = \mu y' + \mu' y$$
So if we can solve
$$\mu' = \frac{2\mu}{t}$$
we'll be a lot closer; but this can be solved using
$$\frac{2}{t} = \frac{\mu'}{\mu} = \left(\ln \mu\right)'$$
Integrating, and choosing the constant of integration so that $\mu(0) = 1$, this leads to
$$\ln \mu = 2 \ln t \implies \boxed{\mu = t^2}$$
So (provided $t \ne 0$) we can rewrite the original equation as
$$ (t^2 y)' = t^2 y' + 2t y = t \sin t$$
Now integrate and solve for $y$.
