[proofplan]
We use the linear-part characterization of an affine map. Choose a base point in the domain [affine space](/page/Affine%20Space), write each point as that base point plus a displacement vector, and use the condition that the coefficients sum to $1$. Linearity of the linear part then moves the affine combination through $f$.
[/proofplan]
[step:Write the affine combination using displacement vectors from a base point]
Let $V$ be the model [vector space](/page/Vector%20Space) of $A$, and let $W$ be the model vector space of $B$. Since $f:A \to B$ is affine, there exists a [linear map](/page/Linear%20Map) $L:V \to W$, called the linear part of $f$, such that for every $a \in A$ and every $v \in V$,
\begin{align*}
f(a+v)=f(a)+L(v).
\end{align*}
Choose the base point $a:=p_1 \in A$. For each $i \in \{1,\ldots,m\}$, define the displacement vector $v_i \in V$ by
\begin{align*}
v_i:=p_i-a.
\end{align*}
The affine combination
\begin{align*}
q:=\lambda_1p_1+\cdots+\lambda_mp_m
\end{align*}
is, by definition of affine-combination notation relative to the base point $a$,
\begin{align*}
q=a+\sum_{i=1}^m \lambda_i v_i.
\end{align*}
[guided]
The expression $\lambda_1p_1+\cdots+\lambda_mp_m$ is not a vector-space linear combination inside $A$, because an affine space has no distinguished zero vector. To compute with it, we choose a base point and convert points into displacement vectors.
Let $V$ be the model vector space of $A$, and let $W$ be the model vector space of $B$. Since $f:A \to B$ is affine, it has a linear part: there is a linear map $L:V \to W$ satisfying
\begin{align*}
f(a+v)=f(a)+L(v)
\end{align*}
for every $a \in A$ and every $v \in V$.
Choose $a:=p_1$. For each $i \in \{1,\ldots,m\}$, define
\begin{align*}
v_i:=p_i-a.
\end{align*}
Thus $v_i$ is the displacement vector from $a$ to $p_i$, so $p_i=a+v_i$. Because the coefficients satisfy $\sum_{i=1}^m \lambda_i=1$, the affine combination with coefficients $\lambda_i$ is represented from the base point $a$ by
\begin{align*}
q:=a+\sum_{i=1}^m \lambda_i v_i.
\end{align*}
This point $q$ is precisely the point denoted by $\lambda_1p_1+\cdots+\lambda_mp_m$.
[/guided]
[/step]
[step:Apply the affine map to the displacement-vector formula]
Using the defining identity for the affine map $f$ with the vector $\sum_{i=1}^m \lambda_i v_i \in V$, we obtain
\begin{align*}
f(q)=f(a)+L\left(\sum_{i=1}^m \lambda_i v_i\right).
\end{align*}
Since $L:V \to W$ is linear,
\begin{align*}
f(q)=f(a)+\sum_{i=1}^m \lambda_i L(v_i).
\end{align*}
For each $i$, the affine identity applied to $p_i=a+v_i$ gives
\begin{align*}
f(p_i)=f(a)+L(v_i).
\end{align*}
Hence
\begin{align*}
L(v_i)=f(p_i)-f(a)
\end{align*}
as a displacement vector in $W$. Substituting this into the previous formula gives
\begin{align*}
f(q)=f(a)+\sum_{i=1}^m \lambda_i\bigl(f(p_i)-f(a)\bigr).
\end{align*}
[/step]
[step:Use the coefficient sum to identify the resulting affine combination]
Expanding the displacement expression in the affine space $B$ gives
\begin{align*}
f(q)=f(a)+\sum_{i=1}^m \lambda_i f(p_i)-\left(\sum_{i=1}^m \lambda_i\right)f(a).
\end{align*}
Since $\sum_{i=1}^m \lambda_i=1$, the $f(a)$ terms cancel in the affine-combination sense, and therefore
\begin{align*}
f(q)=\sum_{i=1}^m \lambda_i f(p_i).
\end{align*}
Recalling that $q=\sum_{i=1}^m \lambda_i p_i$, this is exactly
\begin{align*}
f(\lambda_1p_1+\cdots+\lambda_mp_m)=\lambda_1f(p_1)+\cdots+\lambda_mf(p_m).
\end{align*}
Thus $f$ preserves the given affine combination.
[/step]