  Results are presented for the electromagnetic mass splittings of the low
lying hadrons.
  These are used to determine the non-degenerate light quark masses.
  It is found that m_u=2.24(10)(34), m_d=4.65(15)(32), and $m_s=97.6(2.9)(5.5)$
MeV (MSbar scheme, 2 GeV scale). The first error is statistical and the second
systematic. We find the lowest order electromagnetic splitting
(m_pi+-m_pi0)_QED=3.38(23) MeV, the splittings including next-to-leading order,
(m_pi+-m_pi0)_QED=4.50(23) MeV, (m_K+-m_K0)_QED=1.87(10) MeV, and the m_u !=
m_d contribution to the kaon mass difference, (m_K+-m_K0)_(m_u-m_d)=-5.840(96)
MeV.
  All errors are statistical only, and the next-to-leading order pion splitting
is only approximate; it does not contain all next-to-leading order
contributions. We also computed the proton-neutron mass difference, including
for the first time, QED interactions in a realistic 2+1 flavor calculation. We
find $(m_p-m_n)_{\rm QED}=0.383(68)$ MeV, (m_p-m_n)_(m_u-m_d)=-2.51(14) MeV,
and the total m_p-m_n=-2.13(16)(70) MeV, where the first error is statistical,
and the second, part of the systematic error. We use domain wall fermions and
the Iwasaki gauge action (gauge coupling beta=2.13). We use two lattice sizes,
16^3 and 24^3, to address finite volume effects. Non-compact QED is treated in
the quenched approximation.
  We present new results for the electromagnetic low energy constants in SU(3)
and SU(2) partially-quenched chiral perturbation theory to the next-to-leading
order, obtained from fits to our data.
  Detailed analysis of systematic errors in our results and methods for
improving them are discussed. Finally, new analytic results for SU(2)_L x
SU(2)_R-plus-kaon chiral perturbation theory, including the one-loop logs
proportional to alpha_em*m, are given.
