Given, f(x)cosx+g(x)sinx+C =∫[(3x−1)cosx+(1−2x)sinx]dx =∫I(3x−1)IIcosxdx+∫I(1−2x)IIsinxdx =(3x−1)sinx−∫3sinxdx−(1−2x)cosx+∫(−2)cosxdx
(using integration by parts) =(3x−1)sinx+3cosx−(1−2x)cosx−2sinx+C =(3x−1−2)sinx+(3−1+2x)cosx+C ⇒f(x)cosx+g(x)sinx+C =3(x−1)sinx+2(x+1)cosx+C
On comparing the coefficients of cosx and sinx, we get f(x)=2(x+1) and g(x)=3(x−1)