(D^2+4)y=cos2x+cos4x
Characteristic equation of differential equation r^2+4=0
Roots of it are r_1=-2i and r_2=2i
Hence homogeneous part of it y_h=c_1*sin2x+c_2*cos2x
Due to cos2x is root of homogeneous part of it, particular solution of it is y_p=Axsin2x+Bxcos2x+Csin4x+Dcos4x
Consequently,
D^2(Axsin2x+Bxcos2x+Csin4x+Dcos4x)+4(Axsin2x+Bxcos2x+Csin4x+Dcos4x)=cos2x+cos4x
4Acos2x-4Axsin2x-4Bsin2x-4Bxcos2x-16Csin4x-16Dcos4x+4Axsin2x+4Bxcos2x+4Csin4x+4Dcos4x=cos2x+cos4x
4Acos2x-4Bsin2x-12Csin4x-12Dcos4x=cos2x+cos4x
After equating coefficients,
4A=1, -4B=0, -12C=0 and -12D=1
So, B=C=0, A=1/4 and D=-1/12
Consequently, y_p=1/4xsin2x-1/12cos4x
Thus, y=y_h+y_p=c_1*sin2x+c_2*cos2x+1/4xsin2x-1/12cos4x