Step 1: Integrate \(f'(x)\) to get \(f(x)\).
Given
\[
f'(x) = k(\cos x + \sin x)
\]
Integrating both sides w.r.t. \(x\):
\[
f(x) = k\int(\cos x + \sin x)\,dx
\]
\[
f(x) = k(\sin x - \cos x) + C
\]
Step 2: Use the condition \(f(0)=9\) to find \(C\).
Put \(x=0\):
\[
f(0) = k(\sin 0 - \cos 0) + C = k(0-1) + C = -k + C
\]
Given \(f(0)=9\), so
\[
-k + C = 9 \Rightarrow C = 9 + k
\]
Step 3: Use the condition \(f\!\left(\dfrac{\pi}{2}\right)=15\) to find \(k\).
Put \(x=\dfrac{\pi}{2}\):
\[
f\!\left(\frac{\pi}{2}\right) = k\left(\sin\frac{\pi}{2} - \cos\frac{\pi}{2}\right) + C
\]
\[
= k(1-0) + C = k + C
\]
Given \(f\!\left(\dfrac{\pi}{2}\right)=15\), so
\[
k + C = 15
\]
Now substitute \(C = 9 + k\):
\[
k + (9 + k) = 15 \Rightarrow 2k + 9 = 15 \Rightarrow 2k = 6 \Rightarrow k = 3
\]
Step 4: Write the final function \(f(x)\).
\[
f(x) = k(\sin x - \cos x) + C
\]
\[
f(x) = 3(\sin x - \cos x) + (9+3)
\]
\[
f(x) = 3(\sin x - \cos x) + 12
\]