How to find an exact solution to a certain linear second-order non-homogeneous differential equation The equation below came up in some work I'm doing and I'm at a loss as to how to get a non-numerical solution:
$\ddot x + k_1 \tan( k_1 t) \sec(k_1 t)\dot x+k_2\cos(k_1t) x=k_3\cos(k_1t)$
 A: Assume $k_1,k_2\neq0$ for the key case:
$\ddot x+k_1\tan(k_1t)\sec(k_1t)\dot x+k_2\cos(k_1t)x=k_3\cos(k_1t)$
$\dfrac{d^2x}{dt^2}+\dfrac{k_1\sin(k_1t)}{\cos^2(k_1t)}\dfrac{dx}{dt}+\cos(k_1t)(k_2x-k_3)=0$
$\cos^2(k_1t)\dfrac{d^2x}{dt^2}+k_1\sin(k_1t)\dfrac{dx}{dt}+\cos^3(k_1t)(k_2x-k_3)=0$
Let $u=x-\dfrac{k_3}{k_2}$ ,
Then $\cos^2(k_1t)\dfrac{d^2u}{dt^2}+k_1\sin(k_1t)\dfrac{du}{dt}+k_2\cos^3(k_1t)u=0$
Let $r=\cos(k_1t)$ ,
Then $\dfrac{du}{dt}=\dfrac{du}{dr}\dfrac{dr}{dt}=-k_1\sin(k_1t)\dfrac{du}{dr}$
$\dfrac{d^2u}{dt^2}=\dfrac{d}{dt}\left(-k_1\sin(k_1t)\dfrac{du}{dr}\right)=-k_1\sin(k_1t)\dfrac{d}{dt}\left(\dfrac{du}{dr}\right)-k_1^2\cos(k_1t)\dfrac{du}{dr}=-k_1\sin(k_1t)\dfrac{d}{dr}\left(\dfrac{du}{dr}\right)\dfrac{dr}{dt}-k_1^2\cos(k_1t)\dfrac{du}{dr}=-k_1\sin(k_1t)\dfrac{d^2u}{dr^2}(-k_1\sin(k_1t))-k_1^2\cos(k_1t)\dfrac{du}{dr}=k_1^2\sin^2(k_1t)\dfrac{d^2u}{dr^2}-k_1^2\cos(k_1t)\dfrac{du}{dr}$
$\therefore\cos^2(k_1t)\left(k_1^2\sin^2(k_1t)\dfrac{d^2u}{dr^2}-k_1^2\cos(k_1t)\dfrac{du}{dr}\right)-k_1^2\sin^2(k_1t)\dfrac{du}{dr}+k_2\cos^3(k_1t)u=0$
$k_1^2\sin^2(k_1t)\cos^2(k_1t)\dfrac{d^2u}{dr^2}-k_1^2(\cos^3(k_1t)+\sin^2(k_1t))\dfrac{du}{dr}+k_2\cos^3(k_1t)u=0$
$k_1^2r^2(1-r^2)\dfrac{d^2u}{dr^2}-k_1^2(r^3-r^2+1)\dfrac{du}{dr}+k_2r^3u=0$
$k_1^2r^2(r^2-1)\dfrac{d^2u}{dr^2}+k_1^2(r^2(r-1)+1)\dfrac{du}{dr}-k_2r^3u=0$
$\dfrac{d^2u}{dr^2}+\left(\dfrac{1}{r+1}+\dfrac{1}{r^2(r+1)(r-1)}\right)\dfrac{du}{dr}-\dfrac{k_2r}{k_1^2(r+1)(r-1)}u=0$
$\dfrac{d^2u}{dr^2}+\left(\dfrac{1}{2(r+1)}+\dfrac{1}{2(r-1)}-\dfrac{1}{r^2}\right)\dfrac{du}{dr}-\dfrac{k_2}{2k_1^2}\left(\dfrac{1}{r+1}+\dfrac{1}{r-1}\right)u=0$
