  Recent spectroscopic observations of transiting hot Jupiters have permitted
the derivation of the thermal structure and molecular abundances of H2O, CO2,
CO, and CH4 in these extreme atmospheres. Here, for the first time, we apply
the technique of optimal estimation to determine the thermal structure and
composition of an exoplanet by solving the inverse problem. The development of
a suite of radiative transfer and retrieval tools for exoplanet atmospheres is
described, building upon a retrieval algorithm which is extensively used in the
study of our own solar system. First, we discuss the plausibility of detection
of different molecules in the dayside atmosphere of HD 189733b and the
best-fitting spectrum retrieved from all publicly available sets of secondary
eclipse observations between 1.45 and 24 {\mu}m. Additionally, we use
contribution functions to assess the vertical sensitivity of the emission
spectrum to temperatures and molecular composition. Over the altitudes probed
by the contribution functions, the retrieved thermal structure shows an
isothermal upper atmosphere overlying a deeper adiabatic layer (temperature
decreasing with altitude), which is consistent with previously-reported
dynamical and observational results. The formal uncertainties on retrieved
parameters are estimated conservatively using an analysis of the
cross-correlation functions and the degeneracy between different atmospheric
properties. The formal solution of the inverse problem suggests that the
uncertainties on retrieved parameters are larger than suggested in previous
studies, and that the presence of CO and CH4 is only marginally supported by
the available data. Nevertheless, by including as broad a wavelength range as
possible in the retrieval, we demonstrate that available spectra of HD 189733b
can constrain a family of potential solutions for the atmospheric structure.
