Solution (source code)

= Solution

Write $\widehat{\mathcal C}=[\mathcal C^{\mathrm{op}},\mathbf{Set}]$ and similarly for $\mathcal D$. The induced inverse-image <functor> is precomposition:
$$
u^*:\widehat{\mathcal D}\to\widehat{\mathcal C},
\qquad u^*(Q)=Q\circ f^{\mathrm{op}}.
$$
All <categorical limits> in a <presheaf category> are computed pointwise. Thus $u^*$ preserves every limit, in particular <finite limits>.

Because the indexing categories are small and $\mathbf{Set}$ is complete and cocomplete, both <Kan extensions> along $f^{\mathrm{op}}$ exist. Their universal properties give
$$
\boxed{
u_!=\operatorname{Lan}_{f^{\mathrm{op}}}
\ \dashv\ u^*=(-)\circ f^{\mathrm{op}}
\ \dashv\ u_*=\operatorname{Ran}_{f^{\mathrm{op}}}.}
$$
For example their values are the comma-category formulas
$$
(u_!P)(d)=\operatorname*{colim}_{(f^{\mathrm{op}}\downarrow d)}P(c),
\qquad
(u_*P)(d)=\operatorname*{lim}_{(d\downarrow f^{\mathrm{op}})}P(c).
$$
The comma categories here are formed in $\mathcal D^{\mathrm{op}}$: an object of the first involves $f(c)\to d$ there, equivalently $d\to f(c)$ in $\mathcal D$. An object of the second involves $d\to f(c)$ there, equivalently $f(c)\to d$ in $\mathcal D$. Keeping the opposite category explicit prevents reversal of the two constructions.

The right-hand <adjunction> and finite-limit preservation are exactly the axioms for a <geometric morphism> $u:\widehat{\mathcal C}\to\widehat{\mathcal D}$. The extra <left adjoint> makes it an <essential geometric morphism>. On <representable presheaves>, its <left adjoint> satisfies $u_!(y_{\mathcal C}c)\cong y_{\mathcal D}(fc)$, by the <Yoneda lemma> and the left <adjunction>. This identifies the induced morphism directly with the original <functor> $f$.