dy/dx=sin(x)-y, dy/dx+y=sin(x).
Multiply through by eˣ:
eˣdy/dx+yeˣ=eˣsin(x)
d(yeˣ)/dx=eˣsin(x)
Integrate:
yeˣ=∫eˣsinxdx+k where k is a constant.
Let u=eˣ, dv=sinxdx then du=eˣ, v=-cosx. Let J=∫eˣsinxdx=-eˣcosx+∫eˣcosxdx.
Let dv=cosxdx, then v=sinx, and ∫eˣcosxdx=eˣsinx-∫eˣsinxdx=eˣsinx-J.
So J=-eˣcosx+eˣsinx-J, 2J=eˣ(sinx-cosx), J=½eˣ(sinx-cosx)=yeˣ-k.
But when x=π, y=1, so k=e^π-½e^π(-(-1))=½e^π.
yeˣ=½eˣ(sinx-cosx)+½e^π
y=f(x)=½(sinx-cosx)+½e^(π-x).
CHECK:
dy/dx=½(cosx+sinx)-½e^(π-x)
y=½(sinx-cosx)+½e^(π-x)
Add these equations together:
dy/dx+y=sinx so this confirms the solution.
And when x=π, y=½+½=1.