The linear combination of atomic orbitals to form molecular orbitals takes place only if following conditions are fulfilled :
1. The combining atomic orbitals must have the same or nearly the same energy. This means that in diatomic homonuclear molecules, Is orbital can combine with another Is orbital but not with 2s orbital because the energy of 2s orbital is appreciably higher than that of 1s orbital. This is not true if the atoms are very different like HF, HCl etc.
2. The combining atomic orbitals must overlap to the maximum extent. Greater the extent of overlap, the greater will be the electron density between the nuclei of a molecular orbital.
3. The combining atomic orbitals must have the same symmetry about the molecular axis. By convention, z-axis is taken as the molecular axis. It is important to note that atomic orbitals having same Or nearly the same energy will not combine if they do not have the same symmetry.
For example, 2pz orbital of one atom can combine with 2pz obital of the other atom but not with the 2px or 2py orbitals because of their different symmetries.