[proofplan]
We prove each assertion directly from the cancellation definitions. For a section $s: A \to B$, compose an equality $s \circ u = s \circ v$ on the left with a left inverse $r: B \to A$ to recover $u = v$. For a retraction $r: B \to A$, compose an equality $u \circ r = v \circ r$ on the right with a right inverse $s: A \to B$ to recover $u = v$.
[/proofplan]
[step:Use the left inverse of a section to prove left cancellation]
Let $s: A \to B$ be a section in $\mathcal{C}$. By definition, there exists a morphism $r: B \to A$ such that
\begin{align*}
r \circ s = \operatorname{id}_A.
\end{align*}
We prove that $s$ is a monomorphism. Let $X$ be an object of $\mathcal{C}$, and let $u, v: X \to A$ be morphisms satisfying
\begin{align*}
s \circ u = s \circ v.
\end{align*}
Compose both sides on the left with $r$. By associativity of composition in $\mathcal{C}$,
\begin{align*}
r \circ (s \circ u) &= r \circ (s \circ v), \\
(r \circ s) \circ u &= (r \circ s) \circ v, \\
\operatorname{id}_A \circ u &= \operatorname{id}_A \circ v, \\
u &= v.
\end{align*}
Thus for every object $X$ and every pair of morphisms $u, v: X \to A$, the equality $s \circ u = s \circ v$ implies $u = v$. This is precisely the definition that $s$ is a monomorphism.
[/step]
[step:Use the right inverse of a retraction to prove right cancellation]
Let $r: B \to A$ be a retraction in $\mathcal{C}$. By definition, there exists a morphism $s: A \to B$ such that
\begin{align*}
r \circ s = \operatorname{id}_A.
\end{align*}
We prove that $r$ is an epimorphism. Let $Y$ be an object of $\mathcal{C}$, and let $u, v: A \to Y$ be morphisms satisfying
\begin{align*}
u \circ r = v \circ r.
\end{align*}
Compose both sides on the right with $s$. By associativity of composition in $\mathcal{C}$,
\begin{align*}
(u \circ r) \circ s &= (v \circ r) \circ s, \\
u \circ (r \circ s) &= v \circ (r \circ s), \\
u \circ \operatorname{id}_A &= v \circ \operatorname{id}_A, \\
u &= v.
\end{align*}
Thus for every object $Y$ and every pair of morphisms $u, v: A \to Y$, the equality $u \circ r = v \circ r$ implies $u = v$. This is precisely the definition that $r$ is an epimorphism.
[/step]