In classical thermodynamics the conversation of mass and energy are the principal concepts.
Within an absolutely rigid container which is impermeable for both, the amount of mass and energy is constant.
The conversation of mass is easily understandable. In classical physics matter neither appears from nowhere nor disappears into nirvana nor do elements change their type. That is why alchemists usually fail to make gold from less valuable materials. However, as we know from physics, there is atomic decay, fission, and fusion, which change indeed the character of elements or they are even created or eliminated. These processes would change besides mass also its energy within an isolated container by the relativistic equation
(1)
which relates the energy E by the mass m multiplied by the square of the speed of light c. But in the following such relativistic relations are not considered. Classical thermodynamics keeps it simple and sets Einstein apart. Mathematically one defines the principle of constant mass as
(2)
or better by the differential
(3)
As for mass, for energy we can write
(4)
or differentially
(5)
As can be seen from Equations (3) and (5), that the principle of a constant property is best described by its differential which is then 0. In the following besides absolute values we will be especially interested in differential values.