Internal energy
The internal energy of a thermodynamic system is the energy contained within it. It is the energy necessary to create or prepare the system in any given internal state. It does not include the kinetic energy of motion of the system as a whole, nor the potential energy of the system as a whole due to external force fields, including the energy of displacement of the surroundings of the system. It keeps account of the gains and losses of energy of the system that are due to changes in its internal state. The internal energy is measured as  a difference from a reference zero defined by a standard state. The difference is determined by thermodynamic processes that carry the system between the reference state and the current state of interest. The internal energy is an extensive property, and cannot be measured directly. The thermodynamic processes that define the internal energy are transfers of chemical substances or of energy as heat, and thermodynamic work. These processes are measured by "changes" in the system's extensive variables, such as entropy, volume, and chemical composition. It is often not necessary to consider all of the system's intrinsic energies, for  example, the static rest mass energy of its constituent matter. When mass transfer is prevented by impermeable containing walls, the system is said to be closed and the first law of thermodynamics defines the change in internal energy as the difference between the energy added to the system as heat and the thermodynamic work done by the system on its surroundings. If the containing walls pass neither substance nor energy, the system is said to be isolated and its internal energy cannot change. The internal energy describes the entire thermodynamic information of a system, and is an equivalent representation  to the entropy, both cardinal state functions of only extensive state variables. Thus, its value depends only on the current state of the system and not on the particular choice from many possible processes by which energy may pass to or from the system. It is a thermodynamic potential. Microscopically, the internal energy can be analyzed in terms of the kinetic energy of microscopic motion of the system's particles from translations, rotations, and vibrations, and of the potential energy associated with microscopic forces, including chemical bonds. The unit of energy in the International System of Units (SI) is the  joule (J). The internal energy relative to the mass with unit J/kg is the "specific internal energy". The corresponding quantity relative to the amount of substance with unit J/mol is the "molar internal energy". Cardinal functions. The internal energy of a system depends on its entropy S, its volume V and its number of massive particles: . It expresses the thermodynamics of a system in the "energy representation". As a function of state, its arguments are exclusively extensive variables of state. Alongside the internal energy, the other cardinal function of state of a thermodynamic system is its entropy, as  a function, , of the same list of extensive variables of state, except that the entropy, , is replaced in the list by the internal energy, . It expresses the "entropy representation". Each cardinal function is a monotonic function of each of its "natural" or "canonical" variables. Each provides its "characteristic" or "fundamental" equation, for example , that by itself contains all thermodynamic information about the system. The fundamental equations for the two cardinal functions can in principle be interconverted by solving, for example, for , to get . In contrast, Legendre transforms are necessary to derive fundamental equations for other thermodynamic potentials and Massieu functions . The entropy as a function only of extensive state variables is the one and only "cardinal function" of state for the generation of Massieu functions. It is not itself customarily designated a 'Massieu function', though rationally it might be thought of as such, corresponding to the term 'thermodynamic potential', which includes the internal energy. For real and practical systems, explicit expressions of the fundamental equations are almost always unavailable, but the functional relations exist in principle. Formal, in principle, manipulations of them are valuable for the understanding of thermodynamics. Description and definition. The internal energy formula_1 of a given state  of the system is determined relative to that of a standard state of the system, by adding up the macroscopic transfers of energy that accompany a change of state from the reference state to the given state: where formula_3 denotes the difference between the internal energy of the given state and that of the reference state, and the formula_4 are the various energies transferred to the system in the steps from the reference state to the given state. It is the energy needed to create the given state of the system from the reference state. From a non-relativistic microscopic  point of view, it may be divided into microscopic potential energy, formula_5, and microscopic kinetic energy, formula_6, components: The microscopic kinetic energy of a system arises as the sum of the motions of all the system's particles with respect to the center-of-mass frame, whether it be the motion of atoms, molecules, atomic nuclei, electrons, or other particles. The microscopic potential energy algebraic summative components are those of the chemical and nuclear particle bonds, and the physical force fields within the system, such as due to internal induced electric or magnetic dipole moment, as well as the energy  of deformation of solids (stress-strain). Usually, the split into microscopic kinetic and potential energies is outside the scope of macroscopic thermodynamics. Internal energy does not include the energy due to motion or location of a system as a whole. That is to say, it excludes any kinetic or potential energy the body may have because of its motion or location in external gravitational, electrostatic, or electromagnetic fields. It does, however, include the contribution of such a field to the energy due to the coupling of the internal degrees of freedom of the object with the field. In such a  case, the field is included in the thermodynamic description of the object in the form of an additional external parameter. For practical considerations in thermodynamics or engineering, it is rarely necessary, convenient, nor even possible, to consider all energies belonging to the total intrinsic energy of a sample system, such as the energy given by the equivalence of mass. Typically, descriptions only include components relevant to the system under study. Indeed, in most systems under consideration, especially through thermodynamics, it is impossible to calculate the total internal energy. Therefore, a convenient null reference point may be chosen for the internal  energy. The internal energy is an extensive property: it depends on the size of the system, or on the amount of substance it contains. At any temperature greater than absolute zero, microscopic potential energy and kinetic energy are constantly converted into one another, but the sum remains constant in an isolated system (cf. table). In the classical picture of thermodynamics, kinetic energy vanishes at zero temperature and the internal energy is purely potential energy. However, quantum mechanics has demonstrated that even at zero temperature particles maintain a residual energy of motion, the zero point energy. A system at absolute zero  is merely in its quantum-mechanical ground state, the lowest energy state available. At absolute zero a system of given composition has attained its minimum attainable entropy. The microscopic kinetic energy portion of the internal energy gives rise to the temperature of the system. Statistical mechanics relates the pseudo-random kinetic energy of individual particles to the mean kinetic energy of the entire ensemble of particles comprising a system. Furthermore, it relates the mean microscopic kinetic energy to the macroscopically observed empirical property that is expressed as temperature of the system. While temperature is an intensive measure, this energy expresses  the concept as an extensive property of the system, often referred to as the "thermal energy", The scaling property between temperature and thermal energy is the entropy change of the system. Statistical mechanics considers any system to be statistically distributed across an ensemble of formula_8 microstates. In a system that is in thermodynamic contact equilibrium with a heat reservoir, each microstate has an energy formula_4 and is associated with a probability formula_10. The internal energy is the mean value of the system's total energy, i.e., the sum of all microstate energies, each weighted by its probability of occurrence: This  is the statistical expression of the law of conservation of energy. Internal energy changes. Thermodynamics is chiefly concerned with the changes in internal energy formula_3. For a closed system, with matter transfer excluded, the changes in internal energy are due to heat transfer formula_13 and due to thermodynamic work formula_14 done "by" the system on its surroundings. Accordingly, the internal energy change formula_3 for a process may be written formula_16 When a closed system receives energy as heat, this energy increases the internal energy. It is distributed between microscopic kinetic and microscopic potential energies. In general, thermodynamics does not trace  this distribution. In an ideal gas all of the extra energy results in a temperature increase, as it is stored solely as microscopic kinetic energy; such heating is said to be "sensible". A second kind of mechanism of change in the internal energy of a closed system changed is in its doing of work on its surroundings. Such work may be simply mechanical, as when the system expands to drive a piston, or, for example, when the system changes its electric polarization so as to drive a change in the electric field in the surroundings. If the system is not  closed, the third mechanism that can increase the internal energy is transfer of matter into the system. This increase, formula_17 cannot be split into heat and work components. If the system is so set up physically that heat transfer and work that it does are by pathways separate from and independent of matter transfer, then the transfers of energy add to change the internal energy: formula_18 If a system undergoes certain phase transformations while being heated, such as melting and vaporization, it may be observed that the temperature of the system does not change until the entire sample has  completed the transformation. The energy introduced into the system while the temperature does not change is called "latent energy" or latent heat, in contrast to sensible heat, which is associated with temperature change. Internal energy of the ideal gas. Thermodynamics often uses the concept of the ideal gas for teaching purposes, and as an approximation for working systems. The ideal gas is a gas of particles considered as point objects that interact only by elastic collisions and fill a volume such that their mean free path between collisions is much larger than their diameter. Such systems approximate the monatomic gases , helium and the other noble gases. Here the kinetic energy consists only of the translational energy of the individual atoms. Monatomic particles do not rotate or vibrate, and are not electronically excited to higher energies except at very high temperatures. Therefore, internal energy changes in an ideal gas may be described solely by changes in its kinetic energy. Kinetic energy is simply the internal energy of the perfect gas and depends entirely on its pressure, volume and thermodynamic temperature. The internal energy of an ideal gas is proportional to its mass (number of moles) formula_19 and to its temperature formula_20  where formula_22 is the molar heat capacity (at constant volume) of the gas. The internal energy may be written as a function of the three extensive properties formula_23, formula_24, formula_19 (entropy, volume, mass) in the following way where formula_27 is an arbitrary positive constant and where formula_28 is the universal gas constant. It is easily seen that formula_1 is a linearly homogeneous function of the three variables (that is, it is "extensive" in these variables), and that it is weakly convex. Knowing temperature and pressure to be the derivatives formula_30 formula_31 the ideal gas law formula_32 immediately follows. Internal energy  of a closed thermodynamic system. The above summation of all components of change in internal energy assumes that a positive energy denotes heat added to the system or the negative of work done by the system on its surroundings. This relationship may be expressed in infinitesimal terms using the differentials of each term, though only the internal energy is an exact differential. For a closed system, with transfers only as heat and work, the change in the internal energy is expressing the first law of thermodynamics. It may be expressed in terms of other thermodynamic parameters. Each term is composed  of an intensive variable (a generalized force) and its conjugate infinitesimal extensive variable (a generalized displacement). For example, the mechanical work done by the system may be related to the pressure formula_34 and volume change formula_35. The pressure is the intensive generalized force, while the volume change is the extensive generalized displacement: This defines the direction of work, formula_14, to be energy transfer from the working system to the surroundings, indicated by a positive term. Taking the direction of heat transfer formula_13 to be into the working fluid and assuming a reversible process, the heat is and the change in  internal energy becomes Changes due to temperature and volume. The expression relating changes in internal energy to changes in temperature and volume is This is useful if the equation of state is known. In case of an ideal gas, we can derive that formula_43, i.e. the internal energy of an ideal gas can be written as a function that depends only on the temperature. The expression relating changes in internal energy to changes in temperature and volume is The equation of state is the ideal gas law Solve for pressure: Substitute in to internal energy expression: Take the derivative of  pressure with respect to temperature: Replace: And simplify: To express formula_51 in terms of formula_52 and formula_35, the term is substituted in the fundamental thermodynamic relation This gives: The term formula_57 is the heat capacity at constant volume formula_58 The partial derivative of formula_23 with respect to formula_24 can be evaluated if the equation of state is known. From the fundamental thermodynamic relation, it follows that the differential of the Helmholtz free energy formula_61 is given by: The symmetry of second derivatives of formula_61 with respect to formula_20 and formula_24 yields the Maxwell relation: This gives the expression above. Changes  due to temperature and pressure. When considering fluids or solids, an expression in terms of the temperature and pressure is usually more useful: where it is assumed that the heat capacity at constant pressure is related to the heat capacity at constant volume according to: The partial derivative of the pressure with respect to temperature at constant volume can be expressed in terms of the coefficient of thermal expansion and the isothermal compressibility by writing: and equating d"V" to zero and solving for the ratio d"P"/d"T". This gives: Substituting () and () in () gives the above expression. Changes due to volume at  constant temperature. The internal pressure is defined as a partial derivative of the internal energy with respect to the volume at constant temperature: Internal energy of multi-component systems. In addition to including the entropy formula_23 and volume formula_24 terms in the internal energy, a system is often described also in terms of the number of particles or chemical species it contains: where formula_75 are the molar amounts of constituents of type formula_76 in the system. The internal energy is an extensive function of the extensive variables formula_23, formula_24, and the amounts formula_75, the internal energy may be written as  a linearly homogeneous function of first degree: where formula_81 is a factor describing the growth of the system. The differential internal energy may be written as which shows (or defines) temperature formula_20 to be the partial derivative of formula_1 with respect to entropy formula_23 and pressure formula_34 to be the negative of the similar derivative with respect to volume formula_24 formula_30 formula_31 and where the coefficients formula_90 are the chemical potentials for the components of type formula_91 in the system. The chemical potentials are defined as the partial derivatives of the energy with respect to the variations in composition: As  conjugate variables to the composition formula_93, the chemical potentials are intensive properties, intrinsically characteristic of the qualitative nature of the system, and not proportional to its extent. Under conditions of constant formula_20 and formula_34, because of the extensive nature of formula_1 and its independent variables, using Euler's homogeneous function theorem, the differential formula_97 may be integrated and yields an expression for the internal energy: The sum over the composition of the system is the Gibbs free energy: that arises from changing the composition of the system at constant temperature and pressure. For a single component system, the chemical potential  equals the Gibbs energy per amount of substance, i.e. particles or moles according to the original definition of the unit for formula_93. Internal energy in an elastic medium. For an elastic medium the mechanical energy term of the internal energy is expressed in terms of the stress formula_101 and strain formula_102 involved in elastic processes. In Einstein notation for tensors, with summation over repeated indices, for unit volume, the infinitesimal statement is Euler's theorem yields for the internal energy: For a linearly elastic material, the stress is related to the strain by: where the formula_106 are the components of  the 4th-rank elastic constant tensor of the medium. Elastic deformations, such as sound, passing through a body, or other forms of macroscopic internal agitation or turbulent motion create states when the system is not in thermodynamic equilibrium. While such energies of motion continue, they contribute to the total energy of the system; thermodynamic internal energy pertains only when such motions have ceased. History. James Joule studied the relationship between heat, work, and temperature. He observed that friction in a liquid, such as caused by its agitation with work by a paddle wheel, caused an increase in its temperature, which  he described as producing a "quantity of heat". Expressed in modern units, he found that c. 4186 joules of energy were needed to raise the temperature of one kilogram of water by one degree Celsius.