  Due to the absence of interlayer coupling and inversion symmetry, transition
metal dichalcogenide (MX$_2$) semiconductor monolayers exhibit novel properties
that are distinctly different from their bulk crystals such as direct optical
band gaps, large band spin splittings, spin-valley coupling, piezoelectric and
nonlinear optical responses, and thus have promising applications in, e.g.,
opto-electronic and spintronic devices. Here we have performed a systematic
first-principles study of the second-order nonlinear optical properties of
MX$_2$ (M = Mo, W; X = S, Se) monolayers and trilayers within the density
functional theory with the generalized gradient approximation plus scissors
correction. We find that all the four MX$_2$ monolayers possess large
second-order optical susceptibility $\chi^{(2)}$ in the optical frequency range
and significant linear electro-optical coefficients in low frequency limit,
thus indicating their potential applications in non-linear optical devices and
electric optical switches. The $\chi^{(2)}$ spectra of the MX$_2$ trilayers are
overall similar to the corresponding MX$_2$ monolayers, {\it albeit} with the
magnitude reduced by roughly a factor of 3. The prominent features in the
$\chi^{(2)}$ spectra of the MX$_2$ multilayers are analyzed in terms of the
underlying band structures and optical dielectric function, and also compared
with available experiments.
