If $f^{\prime}(x)=a \sin x+b \cos x$ and $f^{\prime}(0)=4, f(0)=3, f\left(\frac{\pi}{2}\right)=5$, find $f(x)$
Given $f^{\prime}(x)=a \sin x+b \cos x$ and $f^{\prime}(0)=4$
On substituting $x=0$ in $f^{\prime}(x)$, we get
$f^{\prime}(0)=a \sin 0+b \cos 0$
$\Rightarrow 4=a \times 0+b \times 1$
$\Rightarrow 4=0+b$
$\therefore b=4$
Hence, $f^{\prime}(x)=a \sin x+4 \cos x$
On integrating this equation, we have
$\int \mathrm{f}^{\prime}(\mathrm{x}) \mathrm{dx}=\int(a \sin \mathrm{x}+4 \cos \mathrm{x}) \mathrm{dx}$
We know $\int \mathrm{f}^{\prime}(\mathrm{x}) \mathrm{dx}=\mathrm{f}(\mathrm{x})$
$\Rightarrow \mathrm{f}(\mathrm{x})=\int(a \sin \mathrm{x}+4 \cos \mathrm{x}) \mathrm{dx}$
$\Rightarrow \mathrm{f}(\mathrm{x})=\int a \sin \mathrm{x} \mathrm{dx}+\int 4 \cos \mathrm{x} \mathrm{dx}$
$\Rightarrow \mathrm{f}(\mathrm{x})=\mathrm{a} \int \sin \mathrm{x} \mathrm{d} \mathrm{x}+4 \int \cos \mathrm{x} \mathrm{dx}$
Recall $\int \sin x d x=-\cos x+c$ and $\int \cos x d x=\sin x+c$
$\Rightarrow \mathrm{f}(\mathrm{x})=\mathrm{a}(-\cos \mathrm{x})+4(\sin \mathrm{x})+\mathrm{c}$
$\Rightarrow \mathrm{f}(\mathrm{x})=-\mathrm{a} \cos \mathrm{x}+4 \sin \mathrm{x}+\mathrm{c}$
On substituting $x=0$ in $f(x)$, we get
$f(0)=-a \cos 0+4 \sin 0+c$
$\Rightarrow 3=-a \times 1+4 \times 0+c$
$\Rightarrow 3=-a+c$
$\Rightarrow c-a=3$ ......(1)
On substituting $x=\frac{\pi}{2}$ in $f(x)$, we get
$f(0)=-a \cos 0+4 \sin 0+c$
$f\left(\frac{\pi}{2}\right)=-a \cos \frac{\pi}{2}+4 \sin \frac{\pi}{2}+c$
$\Rightarrow 5=-a \times 0+4 \times 1+c$
$\Rightarrow 5=0+4+c$
$\Rightarrow 5=4+c$
$\therefore c=1$
On substituting $c=1$ in equation (1), we get
$1-a=3$
$\Rightarrow a=1-3$
$\therefore a=-2$
On substituting the values of $c$ and $a$ in $f(x)$, we get
$f(x)=-(-2) \cos x+4 \sin x+1$
$\therefore f(x)=2 \cos x+4 \sin x+1$
Thus, $f(x)=2 \cos x+4 \sin x+1$