why some times 2nd shell onward it can hold 8 electrons and other times it is like they can hold K2 L8 M18 N32? when do i have to use first method(K2 L8 M8 N8) and when to use second method (k2 L8 M18)? I'm really confused.
This is a great question that allows us to learn from the periodic table. The previous answer asked if you have learned about orbitals, and if you haven't this is probably why you are having difficulty. If you look at the periodic table, you will see that the elements are arranged in two ways, vertically (group) and horizontally (period), there is good reason for this. Electrons can only occupy space based on mathematical probability; each of these probability functions is what we refer to as orbitals. Each orbital can only hold a maximum number of electrons ( the equation for total electrons is 4l+2 electrons where l is a quantum number starting at l=0 for s, l=1 for p etc.) in the valence shell (for 1, it can hold 2 Starting on the left side of the periodic table with Hydrogen we know that it is in group 1, which means that it has 1 electron in its valence orbital. Element number 2 (He) is a bit of a special case because although it only has 2 electrons in its valence orbital, it is full because the orbital number is 1. What I mean by this is that if you look at period 2 elements, starting with Li, you see that it falls under Hydrogen, and has 1 valence electron. This is because the 1s orbital is full with 2 electrons, and the additional electron goes into the next lowest energy orbital which is called the 2s orbital. Be has 4 electrons, 2 of them in the valence orbital, and 2 of them in the 1s orbital. When we move to B(oron) the 1s and 2s orbitals are full, and we start to fill the 2p orbital. The p orbital can hold a total of 6 (4l+2 where l = 1) electrons and so the boron atom has the following configuration (1s)2(2s)2(2p)1. What you see is that the highest energy orbital (in this case 2 (s + p) is the valence orbital and so B(oron) has 3 valence electrons, but also has 2 electrons in the much lower energy 1s orbital. Think of these orbitals like layers of an onion, where the further from the center, the greater the energy of the orbital. There are rules to how the orbitals are filled and the rules are dictated by quantum mechanics but generally speaking the orbitals are filled as follows 1s 2s 2p 3s 3p 4s 3d 4p 4d using what is know as the Madelung rule. s orbitals can hold 2 electrons, p orbitals can hold 6 electrons, d orbitals can hold 10 electrons. As you work your way from low atomic number on the period table to high you will see why it is organized the way it is. The break between H and He is because of electrons, when you move to period 2 you start filling valence shell 2, when you move to period 3 you start filling valence shell 3 and so on. I hope this helps, and let me know if you need clarification on anything!