Solution (source code)

= Solution

Use $d(\ln\sec x)/dx=\tan x$ and $\ln\sec0=0$. To obtain enough terms of <tangent>, write $t(x)=x+ax^3+bx^5+O(x^7)$; it is an <odd function>. The identity $t'=1+t^2$ gives
$$
1+3ax^2+5bx^4+O(x^6)=1+x^2+2ax^4+O(x^6),
$$
so $a=1/3$, $b=2/15$. Integrate this <Taylor expansion> term by term from zero to $x$:
$$
\boxed{\ln\sec x=\int_0^x\tan t\,dt=\frac{x^2}2+\frac{x^4}{12}+\frac{x^6}{45}+O(x^8).}
$$
There is no constant term, and only even powers occur because $\ln\sec x$ is an <even function> near zero. Thus reaching the first three nonzero terms requires expansion through degree six.