Find the values of $p$ and $q$ such that $\lim_{x\to 0}\frac{x(1-p\cos x)+q\sin x}{x^3}=\frac 13.$ Assume, that L' Hospital's rule is applicable.
I tried solving the problem as follows: Given, $\lim_{x\to 0}\frac{x(1-p\cos x)+q\sin x}{x^3}=\frac 13$ and according to the given information, that L' Hospital's rule is applicable we have, $\lim_{x\to 0}\frac{x(1-p\cos x)+q\sin x}{x^3}=\lim_{x\to 0}\frac{(1-p\cos x)+xp\sin x+q\cos x}{3x^2}=\frac 13.$ Applying L' Hospital's rule again, we have, $\lim_{x\to 0}\frac{(1-p\cos x)+xp\sin x+q\cos x}{3x^2}=\lim_{x\to 0}\frac{p\sin x+xp\cos x+p\sin x-q\sin x}{6x}=\frac 13\implies 3p-q=2.$
This means $p=q=1$ is a solution of the equation.
However, the answer given in the book is, $p=\frac 12=-q.$ However, I don't really understand where did I make the mistake?
Is the way I tried solving this problem a valid approach?
After you get
$\lim_{x\to 0}\frac{(1-p\cos x)+xp\sin x+q\cos x}{3x^2}$,
it can be written as
$\lim_{x\to 0}\frac{1-(p-q)\cos x+xp\sin x}{3x^2}$.
At this moment, it should be noted that $p-q$ must be $1$, otherwise the limit will be $\infty$ or $-\infty$. Thus, we have $p-q=1$, and
$\lim_{x\to 0}\frac{1-\cos x+xp\sin x}{3x^2}=\lim_{x\to 0}\frac{\sin x+p(\sin x+x\cos x)}{6x}=\lim_{x\to 0}\frac{\cos x+p(\cos x+\cos x-x\sin x)}{6}$ $=\frac{1+2p}{6}$ .
Now letting $\frac{1+2p}{6}=\frac{1}{3}$ yields $p=\frac{1}{2}$ and then $q = -\frac{1}{2}$.