The given function is
y = e-x + 2
Differentiating equation (1) w.r.t 'x', we get
\(\frac{dy}{dx}\) = - e-x
From equations (1) and (2), we get

Thus, the function y = e-x + 2 is the solution of the differential equation \(\frac{dy}{dx}\) + y = 2.
Hence Proved.