Although a good answer has already been provided as a result of a request to provide an answer I’ll do to make it clearer and then add slightly different, however more straightforward explanation.
The process of filling up orbitals is dependent on the principle of Aufbau. In simple terms, the principle states that in the state of ground atoms, electrons within their orbitals get filled with an ascending order of energy levels. Naturally, the lowest energy electrons will be filled first before they would proceed to fill the orbitals that are higher in energy.
If you look at the orbitals with a the first sight, it’s not difficult to fall into a trap of thinking that 4s orbitals are more energetic in comparison to 3d orbitals. Let’s examine how this calculation is made.
Orbitals’ energy is determined using the (n+l) rule. “n” here is the principal quantum number and “l” can be described as the azimuthal quantum numbers [don’t go into specifics, as I don’t want to be confusing hahaI’m sorry to confuse you. Orbitals that have lower values of (n+l) have less energy and are filled in the first place before shifting to ones with higher values in (n+1). In the case of 3d and 4s orbitals the 4s orbital has 4 n and l=0. Therefore, 4+0=4 while the 3d orbital is n=3 and 3+2 = 5. Therefore, 4s is less energetic value of 4 compared to the 3d orbital, which has an energy level of 5. Hence, for this reason 4s is filled first prior to moving on onto the 3d orbital.
When you put this in practice, because you don’t need to explain the logic of filling 4s up first, here’s an excellent small chart that I used when I was in high school when I was trying to solve the problem without thinking about the logic behind the reasoning behind it. If following the line beginning with 1s, you can determine which orbital is in line next , and then go through to 4 you’ll see that the order is 3p 4s the 3d, which will aid you in the event that you’re stuck or can’t remember the problem.
I hope this is helpful. Cheers! 🙂