Given \(i\in \{2,3\}\text{,}\) say that a vertex \(x\in X_1\) is bad for \(X_i\) if it has fewer than \((d(X_1,X_i)-\varepsilon)|X_i|\) neighbours in \(X_i\text{.}\) Let \(X_{1,i}'\) be the set of all vertices that are bad for \(X_i\text{.}\) Then, by definition,
\begin{equation*}
e(X_{1,i}',X_i) \lt \left(d(X_1,X_i) - \varepsilon\right)|X_{1,i}'||X_{i}|
\end{equation*}
and so \(|d(X_{1,i}',X_{i})-d(X_1,X_{i})|>\varepsilon\text{.}\) Since \((X_1,X_{2})\) is \(\varepsilon\)-regular, and \(|X_i|>\varepsilon|X_i|\text{,}\) this implies that \(|X_{1,i}'| \lt \varepsilon|X_1|\text{.}\)
Now, let \(Y_1:=X_1\setminus(X_{1,2}'\cup X_{1,3}')\text{.}\) As we have shown above, \(|Y_1|\geq |X_1|-2\varepsilon|X_1|=(1-2\varepsilon)|X_1\text{.}\) Note that any \(x\in Y_1\) is contained in exactly
\begin{equation*}
e(N(x)\cap X_2,N(x)\cap X_3)
\end{equation*}
\begin{equation*}
=|N(x)\cap X_2||N(x)\cap X_3|\cdot d(N(x)\cap X_2,N(x)\cap X_3)
\end{equation*}
triangles in \(G\text{.}\) Since \(x\in Y_1\text{,}\) it has at least \((d(X_1,X_{2})-\varepsilon)|X_{2}| > \varepsilon |X_2|\) neighbours in \(X_2\) and at least \((d(X_1,X_{3})-\varepsilon)|X_{3}|>\varepsilon|X_3|\) in \(X_3\text{.}\) So, since \((X_2,X_3)\) is \(\varepsilon\)-regular, the number of triangles containing \(x\) is at least
\begin{equation*}
(d(X_1,X_{2})-\varepsilon)(d(X_1,X_{3})-\varepsilon)(d(X_2,X_3)-\varepsilon)|X_{2}||X_{3}|\text{.}
\end{equation*}
Thus, we are now done by summing the number of triangles containing \(x\) over all \(x\in Y_1\text{.}\)