Solution (source code)

= Solution

Let $\widetilde H=i\tau^2H^*$. Gauge invariance permits the <Yukawa interactions>
$$
\mathcal L_Y
=-\overline Q_LY_dHd_R
-\overline Q_LY_u\widetilde H u_R+\mathrm{h.c.},
$$
where $Y_u,Y_d$ are arbitrary complex $3$ by $3$ matrices in generation space. Their color and weak indices are contracted to singlets, and the hypercharges in each term sum to zero.

After symmetry breaking,
$$
\mathcal L_Y\supset
-\overline d_LM_dd_R-\overline u_LM_uu_R+\mathrm{h.c.},
\qquad
M_d=\frac v{\sqrt2}Y_d,
\qquad
M_u=\frac v{\sqrt2}Y_u.
$$
The same terms couple the physical Higgs field proportionally to the quark mass matrices.