We need to solve xdxdy+2y=xex with y(1)=0, then find the local maximum of z(x)=x2y(x)−ex.
First, we rewrite the differential equation as dxdy+x2y=ex and identify the integrating factor as μ=e∫x2dx=x2.
Next, multiplying through by this integrating factor gives dxd(x2y)=x2ex, and integrating both sides yields x2y=∫x2exdx=x2ex−2xex+2ex+C=ex(x2−2x+2)+C.
Now applying the initial condition y(1)=0 leads to 1⋅0=e1(1−2+2)+C⟹0=e+C⟹C=−e, so that x2y=ex(x2−2x+2)−e.
Since z(x)=x2y−ex, substituting the expression for x2y gives z(x)=ex(x2−2x+2)−e−ex=ex(x2−2x+1)−e=ex(x−1)2−e.
Next, differentiating yields z′(x)=ex(x−1)2+ex⋅2(x−1)=ex(x−1)[(x−1)+2]=ex(x−1)(x+1), so the critical points are x=1 and x=−1.
Performing a sign analysis of z′(x)=ex(x−1)(x+1) shows that for x<−1 both factors (x−1) and (x+1) are negative, yielding z′>0, while for −1<x<1 the factor (x−1) is negative and (x+1) is positive, giving z′<0. Therefore, x=−1 is a local maximum.
Finally, evaluating at this point gives z(−1)=e−1(−1−1)2−e=e4−e. Hence the correct answer is Option D: e4−e.