Solution:
Key idea: A function is a solution of a differential equation if, when the function and its derivatives are put into the equation, the equation becomes true for every x in the domain. So we find the derivatives the equation needs, substitute them, and simplify one side until it equals the other.
Step 1 — Find the first derivative.
We use the product rule on ex and cosx.
dxdy=excosx−exsinx=ex(cosx−sinx)
Step 2 — Find the second derivative.
We use the product rule again on ex and (cosx−sinx), whose derivative is −sinx−cosx.
dx2d2y=ex(cosx−sinx)+ex(−sinx−cosx)=−2exsinx
Step 3 — Substitute into the left side.
We put y and both derivatives into dx2d2y−2dxdy+2y.
dx2d2y−2dxdy+2y=−2exsinx−2ex(cosx−sinx)+2excosx=−2exsinx−2excosx+2exsinx+2excosx=0
The left side equals the right side for every real x.
Note: The book prints the function as y=excosbx. For a general b the left side works out to (1−b2)excosbx, which is zero for every x only when b=±1, so the intended function is y=excosx; a general excosbx satisfies dx2d2y−2dxdy+(1+b2)y=0 instead.
Therefore, y=excosx is a solution of the given differential equation.