Solution (source code)

= Solution
{c}

Write the integral with an explicit dummy time:
$$
X_t=M_t-\int_0^tZ_s^{-1}\,d\langle M,Z\rangle_s.
$$
On every compact time interval, strict positivity and continuity of $Z$ make its reciprocal locally bounded; the covariation has locally finite variation. Thus $X$ is a well-defined continuous semimartingale.

Apply the <Itô product rule>. Subtracting a finite-variation process does not change covariation, so $[Z,X]=[Z,M]$. The finite-variation terms cancel:
$$
\begin{aligned}
d(ZX)&=X\,dZ+Z\,dX+d[Z,X]\\
&=X\,dZ+Z\,dM-d[M,Z]+d[Z,M]\\
&=X\,dZ+Z\,dM.
\end{aligned}
$$
Thus $ZX$ is a local martingale under $\mathbb P$.

For the transfer step, choose stopping times increasing to the horizon that bound $X$, $M$, reciprocal $Z$, and the brackets needed for the stochastic integrals. For each such time $\sigma$, the same product calculation with $X^\sigma$ shows that $Z_tX_{t\wedge\sigma}$ is a true $\mathbb P$ martingale. The part after $\sigma$ is simply the bounded held value $X_\sigma$ times the density martingale. By the <Bayes formula for conditional expectation>, for $s\leq t$,
$$
\mathbb E_{\mathbb Q}(X_{t\wedge\sigma}\mid\mathcal F_s)
=\frac{\mathbb E_{\mathbb P}(Z_tX_{t\wedge\sigma}\mid\mathcal F_s)}{Z_s}
=X_{s\wedge\sigma}.
$$
The stopping times exhaust the horizon also under $\mathbb Q\ll\mathbb P$. Hence \b[$X$ is a continuous $\mathbb Q$ local martingale], proving this form of the <Girsanov theorem> without assuming a positive terminal density everywhere.