Connected sum of surfaces (source code)

= Connected sum of surfaces
{title2=$M\mathbin\#N$}

For two <connected> closed <surfaces>, remove an open disc from each and identify the resulting boundary <circles> by a <homeomorphism>. The resulting closed <surface> is their connected sum, defined up to <homeomorphism> independently of these choices. A <triangulation> version removes one triangular face from each and glues their boundary three-cycles by a <simplicial homeomorphism>.

At a seam vertex the two vertex <links of a simplex> are paths; gluing their matching endpoints produces a <cycle graph>, proving the local <surface> condition. Removing a triangular face subtracts one from each <Euler characteristic>, while boundary gluing reduces both the vertex count and the edge count by three. Therefore $\chi(M\mathbin\#N)=\chi(M)+\chi(N)-2$. If the result were <orientable>, either punctured summand would inherit consistent choices of <orientation of a simplex>, and these would extend over its capping face. Thus a nonorientable summand forces a <nonorientable surface> result. The <classification theorem for closed combinatorial surfaces> then gives $T^2\mathbin\#\mathbb{RP}^2\cong\mathbb{RP}^2\mathbin\#\mathbb{RP}^2\mathbin\#\mathbb{RP}^2$.