Opacity (optics)
Opacity is the measure of impenetrability to electromagnetic or other kinds of radiation, especially visible light.  In radiative transfer, it describes the absorption and scattering of radiation in a medium, such as a plasma, dielectric, shielding material, glass, etc.  An opaque object is neither transparent (allowing all light to pass through) nor translucent (allowing some light to pass through).  When light strikes an interface between two substances, in general some may be reflected, some absorbed, some scattered, and the rest transmitted (also see refraction).  An opaque substance transmits very little light, and therefore reflects, scatters, or absorbs most of it.  Both mirrors and carbon black are opaque.  Opacity depends on the frequency of the light being considered.  For instance, some kinds of glass, while transparent in the visual range, are largely opaque to ultraviolet light.  More extreme frequency-dependence is visible in the absorption lines of cold gases.  In general, a material tends to emit different colors in the same proportions as it absorbs it.

# Definition
The opacity \kappa_\nu gives the rate of absorption (or extinction), which is the fraction of the intensity I_\nu, of the radiation that is absorbed or scattered per unit distance along a ray of propagation:
For a given medium it has a numerical value that may range between 0 and infinity. 
It is also called the absorption coefficient (see also extinction coefficient). 
In general  \kappa_\nu depends on the frequency \nu of the radiation, as well as the density, temperature, and composition of the medium. 
The mean free path is the distance a photon travels in the medium before absorption or scattering is defined as 1/(\kappa_\nu \rho), where \rho is the density of the material. The notation \kappa_\lambda is the opacity described as a function of wavelength \lambda. 
While many materials are very opaque (steel in visible light having near-infinite opacity), and others very transparent (air in visible light having near-zero opacity), so that opacity often seems to be a boolean property, many others (such as water) have intermediate opacity.
In astronomy and planetary imaging fields, tau, the optical depth, defines the opacity: zero indicates transparent and higher numbers indicate more and more opaque in an inverse exponential fashion, for example a tau of 1 indicates 36 percent of the light passes (e-1 = 0.36), and a Tau of 5 indicates less than 1 percent passes (e -5 = 0.0067).
In astrophysics and plasma physics "opacity", or absorption coefficient, \kappa_\nu is defined so that \kappa_\nu \rho I_\nu d\nu d\Omega gives the corresponding energy absorbed per unit volume per unit time from a beam of given intensity I_\nu in a medium of density \rho (thus \kappa_\nu is measured in {\rm cm}^2 {\rm g}^{-1}).
The optical depth \tau_\nu along the propagation direction is then d \tau_\nu = \kappa_\nu \rho ds, where ds is the distance along this direction. It is customary to define the average opacity, calculated using a certain weighting scheme. Planck opacity uses normalized Planck black body radiation energy density distribution as the weighting function, and averages \kappa_\nu directly. Rosseland opacity, on the other hand, uses a temperature derivative of Planck distribution (normalized) as the weighting function, and averages \kappa_\nu^{-1},
The photon mean free path is  \lambda_\nu = (\kappa_\nu \rho)^{-1}. The Rosseland opacity is derived in the diffusion approximation to the radiative transport equation. It is valid whenever the radiation field is isotropic over distances comparable to or less than a radiation mean free path, such as in local thermal equilibrium. In practice, the mean opacity for Thomson electron scattering is \kappa_{\rm es} = 0.40 {\rm cm}^2 {\rm g}^{-1} and for nonrelativistic thermal bremsstrahlung, or free-free transitions, it is \kappa_{\rm ff}(\rho, T) = 0.64 \times 10^{23} (\rho)(T)^{-7/2} {\rm cm}^2 {\rm g}^{-1}.
The Rosseland mean absorption coefficient including both scattering and absorption (also called the extinction coefficient) is

# Applications
In astrophysics, the variations in opacity within a star are important to the understanding of  radiation transfer in stellar atmospheres and the spectra we observe.
In several types of chemical analysis, the concentration of a sample in a transparent medium (typically air or water) is determined via measuring its opacity or absorbance.  In spectrophotometry the device identifies the sample's constituent substances from their absorbances.
Opacity is also used as a measurement of particulate emissions.

# Extinction coefficient
The extinction coefficient for a particular substance is a measure of how well it scatters and absorbs electromagnetic radiation (EM waves). If the EM wave can pass through very easily, the material has a low extinction coefficient. Conversely, if the radiation hardly penetrates the material, but rather quickly becomes "extinct" within it, the extinction coefficient is high.
A material can behave differently for different wavelengths of electromagnetic radiation. Glass is transparent to visible light, but many types of glass are opaque to ultra-violet wavelengths. In general, the extinction coefficient for any material is a function of the incident wavelength. The extinction coefficient is used widely in ultraviolet-visible spectroscopy.

# Physical definitions
The parameter used to describe the interaction of electromagnetic radiation with matter is the complex index of refraction, n, which is a combination of a real part and an imaginary part:
Here, n is also called the index of refraction, which sometimes leads to confusion. k is the extinction coefficient, which represents the damping of an EM wave inside the material. Both depend on the wavelength.
An EM wave travels in the material with velocity v and angular frequency \omega. The time-varying electric field of the wave is described by
where only the real part of \mathbf E has physical significance. For simplicity, the radiation is assumed to be a plane wave, and its direction of propagation is denoted  z.
The index of refraction is defined to be the ratio of the speed of light in a vacuum to the speed of the EM wave in the medium:
Substituting for \tilde{n} in the expression above gives
Substituting this in the expression for the EM wave's electric field gives
This expression describes a propagating electromagnetic wave with an exponentially damped amplitude due to the k term. This term causes the EM wave to "die out" as it travels further into the material. The intensity of the wave, which corresponds to the energy it carries with it, is simply the square of the magnitude of the wave's electric field. The intensity of the wave is therefore
A law called the Beer-Lambert law states that in any medium that is absorbing light, the decrease in intensity I per unit length z is proportional to the instantaneous value of I. In mathematical form this is
where \alpha is the absorption coefficient of the material for that wavelength of EM radiation. This equation has the solution
where I_0 is the intensity of the electromagnetic radiation at the surface of the absorbing medium. Comparing the two expressions for intensity obtained above gives
Since c here denotes the speed of the EM wave in vacuum,
Substituting this in the expression above and rearranging shows that the extinction coefficient and the absorption coefficient are related by
where  is the vacuum wavelength (not the wavelength of the EM wave in the material).