By separating variables and integrating,

#int e^{-y}cosy dy=int (1+x^2)e^{-x} dx#

Integration by Parts 1

#u=e^{-y}" "dv=cosy dy#.

#du=-e^{-y} dy" "v=siny#.

Integration by Parts 2

#u=e^{-y}" "dv=siny dy#.

#du=-e^{-y}dy" "v=-cosy#

By Integration by Pats 1,

#(LHS)=e^{-y}siny+int e^{-y}siny dy#

by Integration by Parts 2,

#=e^{-y}siny-e^{-y}cosy-int e^{-y}cosy dy#

Since the last integral is the same as #(LHS)#, we have

#(LHS)=e^{-y}(siny-cosy)-(LHS)#

by adding #(LHS)#,

#Rightarrow2(LHS)=e^{-y}(siny-cosy)#

by dividing by #2#,

#Rightarrow (LHS)=e^{-y}/2(siny-cosy)#

Integration by Parts 3

#u=1+x^2" "dv=e^{-x}dx#

#du=2xdx" "v=-e^{-x}#

Integration by Parts 4

#u=2x" "dv=e^{-x}dx#

#du=2dx" "v=-e^{-x}#

Let us evaluate the right-hand side.

By Integration by Parts 3,

#(RHS)=-(1+x^2)e^{-x}+int2xe^{-x}dx#

by Integration by Parts 4,

#=-(1+x^2)-2xe^{-x}+int 2e^{-x} dx#

#=-(x^2+2x+1)e^{-x}-2e^{-x}+C#

#=-(x^2+2x+3)e^{-x}+C#

By setting #(LHS)=(RHS)#,

#e^{-y}/2(siny-cosy)=-(x^2+2x+3)e^{-x}+C#

Since #y(0)=0#, we have

#Rightarrow 1/2(0-1)=-3+C Rightarrow C=5/2#

Hence, the solution is implicitly expressed as

#e^{-y}/2(siny-cosy)=-(x^2+2x+3)e^{-x}+5/2#.

I hope that this was helpful.