Solution:
Key idea: We integrate f′(x) to get f(x) with one unknown constant C. The three given values then supply three equations for the three unknowns a, b and C.
Step 1 — Use f′(0)=4 to find b.
We put x=0 in f′(x); since sin0=0 and cos0=1, only b is left.
f′(0)=asin0+bcos0
f′(0)=b
b=4
Step 2 — Integrate f′(x).
We use ∫sinxdx=−cosx and ∫cosxdx=sinx.
f(x)=∫(asinx+bcosx)dx
f(x)=−acosx+bsinx+C
Step 3 — Use f(2π)=5 to find C.
At x=2π, cosx=0 and sinx=1, so only b+C is left, and b=4.
f(2π)=b+C
4+C=5
C=1
Step 4 — Use f(0)=3 to find a.
At x=0, cosx=1 and sinx=0.
f(0)=−a+C
−a+1=3
a=−2
Step 5 — Write f(x).
We substitute a=−2, b=4 and C=1; then −acosx becomes 2cosx.
f(x)=2cosx+4sinx+1
As a check, we put x=0 in f and in f′(x)=−2sinx+4cosx.
f(0)=2+0+1
f(0)=3
f′(0)=0+4
f′(0)=4
Both agree with the given values.
Therefore, f(x)=2cosx+4sinx+1.