Step 1: Set up the reduction formula for $\int \cos^n x\,dx$.
Let $I_n^c = \int \cos^n x\,dx$. Using integration by parts with $u = \cos^{n-1}x$ and $dv = \cos x\,dx$: $I_n^c = \cos^{n-1}x\sin x + (n-1)\int\cos^{n-2}x\sin^2 x\,dx$.
Step 2: Use $\sin^2 x = 1 - \cos^2 x$ to simplify.
$I_n^c = \cos^{n-1}x\sin x + (n-1)I_{n-2}^c - (n-1)I_n^c$. So $n I_n^c = \cos^{n-1}x\sin x + (n-1)I_{n-2}^c$.
Step 3: Similarly derive the reduction for $\int \sin^n x\,dx$.
By the analogous argument: $n I_n^s = -\sin^{n-1}x\cos x + (n-1)I_{n-2}^s$.
Step 4: Add the two reduction formulas.
With $I_n = I_n^c + I_n^s$ and $I_{n-2} = I_{n-2}^c + I_{n-2}^s$: $n I_n = \cos^{n-1}x\sin x - \sin^{n-1}x\cos x + (n-1)I_{n-2} = \sin x\cos x(\cos^{n-2}x - \sin^{n-2}x) + (n-1)I_{n-2}$.
Step 5: Rearrange to match the given form.
$I_n - \frac{n-1}{n}I_{n-2} = \frac{\sin x\cos x}{n}(\cos^{n-2}x - \sin^{n-2}x)$. Comparing with $\frac{\sin x\cos x}{n}\cdot f(x)$: $f(x) = \cos^{n-2}x - \sin^{n-2}x$.
Step 6: State the final answer.
\[\boxed{f(x) = \cos^{n-2}x - \sin^{n-2}x}\]