  The generation of harmonic radiation through a non-linear mechanism driven by
bunching at fundamental frequency is an important option in the operation of
high gain Free-Electron Lasers (FELs). The use of harmonic generation at a
large scale facility may result in achieving shorter radiation wavelengths for
the same electron beam energy. This paper describes a theory of second harmonic
generation in planar undulators with particular attention to X-Ray FELs
(XFELs). Our study is based on an exact analytical solution of Maxwell
equations, derived with the help of the Green's function method. On the
contrary, up-to-date theoretical understanding of the second harmonic
generation is only limited to some estimation of the total radiation power
based on the source part of the wave equation. Moreover, we find that such part
of the wave equation is presented with several incorrect manipulations among
which is the omission of an important contribution. Our work yields correct
parametric dependencies and specific predictions of additional properties such
as polarization, angular distribution of the radiation intensity and total
power. The most surprising prediction is the presence of a vertically polarized
part of the second harmonic radiation, whereas up-to-date understanding assumes
that the field is horizontally polarized. Altogether, this paper presents the
first correct theory of second harmonic generation for high gain FELs.
