The empirical laws that led to the derivation of the ideal gas law were discovered with experiments that changed only 2 state variables of the gas and kept every other one constant.
All the possible gas laws that could have been discovered with this kind of setup are:
* Boyle's law () 
* Charles's law () 
* Avogadro's law () 
* Gay-Lussac's law () 
where P stands for pressure, V for volume, N for number of particles in the gas and T for temperature; where  are constants in this context because of each equation requiring only the parameters explicitly noted in them changing.
To derive the ideal gas law one does not need to know all 6 formulas, one can just know 3 and with those derive the rest or just one more to be able to get the ideal gas law, which needs 4.
Since each formula only holds when only the state variables involved in said formula change while the others (which are a property of the gas but are not explicitly noted in said formula) remain constant, we cannot simply use algebra and directly combine them all. This is why:  Boyle did his experiments while keeping N and T constant and this must be taken into account (in this same way, every experiment kept some parameter as constant and this must be taken into account for the derivation).
Keeping this in mind, to carry the derivation on correctly, one must imagine the gas being altered by one process at a time (as it was done in the experiments). The derivation using 4 formulas can look like this:
at first the gas has parameters 
Say, starting to change only pressure and volume, according to Boyle's law (), then:
After this process, the gas has parameters 
Using then equation () to change the number of particles in the gas and the temperature,
After this process, the gas has parameters 
Using then equation () to change the pressure and the number of particles,
After this process, the gas has parameters 
Using then Charles's law (equation 2) to change the volume and temperature of the gas,
After this process, the gas has parameters 
Using simple algebra on equations (), (), () and () yields the result:
 or  where  stands for the Boltzmann constant.
Another equivalent result, using the fact that , where n is the number of moles in the gas and R is the universal gas constant, is:
 which is known as the ideal gas law.
If three of the six equations are known, it may be possible to derive the remaining three using the same method. However, because each formula has two variables, this is possible only for certain groups of three. For example, if you were to have equations (), () and () you would not be able to get any more because combining any two of them will only give you the third. However, if you had equations (), () and () you would be able to get all six equations because combining () and () will yield (), then () and () will yield (), then () and () will yield (), as well as would the combination of () and () as is explained in the following visual relation:
where the numbers represent the gas laws numbered above.
If you were to use the same method used above on 2 of the 3 laws on the vertices of one triangle that has a "O" inside it, you would get the third.
For example:
Change only pressure and volume first:
then only volume and temperature:
then as we can choose any value for , if we set , equation () becomes:
combining equations () and () yields , which is equation (), of which we had no prior knowledge until this derivation.