Here,
#f(x)=(xe^x)^2#
Let,
#y=u^2 ,where, color(red)(u=x*e^x)#
#:.(dy)/(du)=2u .......to(1)# .
#" Using "color(blue)"Product Rule" # , we get
#(du)/(dx)=x*d/(dx)(e^x)+e^x*d/(dx)(x)#
#=>(du)/(dx)=x*e^x+e^x*1...to(2)#
Now ,#"using "color(blue)"Chain Rule":#
#color(blue)((dy)/(dx)=(dy)/(du)*(du)/(dx)#
#(dy)/(dx)=(2color(red)(u))xx(xe^x+e^x)....toFrom (1) and (2)#
#:.(dy)/(dx)=2color(red)((xe^x))xx(xe^x+e^x)#
#(dy)/(dx)=2xe^x xx e^x(x+1)#
#(dy)/(dx)=2x(x+1)e^(2x)#
...........................................................................................................
OR
#f(x)=(xe^x)^2=x^2e^(2x)#
#=>f'(x)=x^2d/(dx)(e^(2x))+e^(2x)d/(dx)(x^2)#
#=>f'(x)=x^2e^(2x)*2+e^(2x)(2x)=2x^2e^(2x)+2xe^(2x)#
Hence,
#f'(x)=(2x^2+2x)e^(2x)=2x(x+1)e^(2x)#