How was the ideal gas equation, #PV = nRT#, derived?
Experimentally, by collating various experiments by Boyle, Charles etc
You can also derive it 'logically' from 'first principles' - deduce the shape of the following sketch graphs, for instance: volume vs pressure, thermodynamic temperature (in K) vs pressure, volume vs thermodynamic temperature (in K) and number of moles vs pressure. If you use each to deduce the relationship between the different variables, you will find that pressure is proportional to number of moles and to temperature and inversely proportional to volume. Putting this all together, pressure equals a constant times n, times T over V. The constant is found, again experimentally, and is called R, the Universal Gas Constant.