So the Lagrange remainder is given by:
$$R_n(x)=\frac{f^{n+1}(c)}{(n+1)!}(x-a)^{n+1}.$$
We want $\cos(\frac14)$ and we can do it around $a=0$. We know that $f^{n+1}$ is either $\pm\cos x$ or $\pm\sin x$, which are both bounded with an absolute value of $1$:
$$|\cos x|\le1,\qquad |\sin x|\le 1.$$
So we can say the following is true:
$$|R_n(x)|=\frac{f^{n+1}(c)}{(n+1)!}\left(\frac14\right)^{n+1}\le 1\cdot\frac{1}{(n+1)!}\left(\frac14\right)^{n+1} $$
And we get:
$$|R_n(x)|\le \frac{1}{(n+1)!}\left(\frac14\right)^{n+1} $$
Let's try $n=6$:
$$\frac{1}{10^{12}}\le \frac{1}{7!}\left(\frac14\right)^{7} =\frac{1}{5040}\cdot\frac{1}{16384}=\frac{1}{82575360} $$
$$\frac{1}{10^{12}}\le \frac{1}{82575360} $$
Is $n=6$ enough? Or do I have to continue?
You want the error to be less than $10^{-12}$, so you want $|R_n(x)|<\frac{1}{10^{12}}$. You know that $$|R_n(x)|\leq\frac{1}{(n+1)!}\left(\frac{1}{4}\right)^n,$$ so you want to find $n$ such that $$\frac{1}{(n+1)!}\left(\frac{1}{4}\right)^n<\frac{1}{10^{12}},$$ so that you can combine the inequalities to get $|R_n(x)|<\tfrac{1}{10^{12}}$. The bound decreases as $n$ increases, and you have already calculated the bound for $n=7$, which was too big. So try $n=8$, or $n=9$, or...