Using Gronwall' inequality, I need to show that the solution of the following initial value problem
$x'(t)=(1-a \cos{t})x$, $x(0)=x_0$
satisfies $|x(t)| \leq |x_0| e^{(1+a)t} $.
Here, $0<a<1$.
Gonwall's inequality says: if $g(t)$ is continuous real valued function with $g(t) \geq 0$ and
$g(t) \leq C+K \int_{0}^t g(s) ds $ for all $0 \leq t \leq a$ then we have $g(t) \leq C e^{Kt}$.
My work,
The solution of the initial value problem is $x(t)=C \exp{(t-a \sin t)}$. Then I tried to take $g(t)=\exp{(t-a \sin t)}$ but I couldn't apply the inequality to get the required result. Any idea what $g(t)$ should be taken?
This is probably too simple as one can, as you did, easily write down the exact solution.
What was intended was to get the estimate $$ |1-a\cos(t)|\le 1+|a| $$ and the apply Grönwall to the differential inequality $$ |x'|\le (1+a)|x| $$ which results in the claimed bound.
Note that ($t>0$, $a>0$) $$ |\sin t|\le\min(|t|,1)\le |t|\implies t-a\sin t\le (1+a)t $$ is a very wide upper bound