# Why is there a divider circuit here?

So I'm pretty new to electronics and just started playing around with the Arduino to learn the basics. In one of the projects there was just a simple button and 3 LEDs that are controlled by the Arduino. Following is the schematic:

As there is no explanation in the book as to why there's a 10KΩ resistor, I did some Googling as to why it's there. I found out it's a voltage divider and keeps a 5V $V_{out}$ into the Arduino 2 pin.

My question is, is this resistor necessary? I know it follows the following equation:

$$V_{out} = V_{in} \times \dfrac{R_2}{R_1 + R_2}$$

So if there's no $R_2$, I'd be dividing 0 by 0. In which I'm guessing it's a short circuit? But any resistor of like 1Ω would still allow the 5V $V_{out}$. Which would mean that any resistor avoids short circuits? What if I don't connect it to ground at all? Can't it flow just directly from 5V to pin 2 through some internal ground?

I'm kind of reluctant to just try it out myself and see what happens out of fear I'm going to fry some components.

R2 is 10k. R1 is milliohms (im guessing 10) resistance of the switch. When the switch is closed the voltage would be approximately 5 * (10k / 10000.01) which is basically 5V (it is reduced by maybe 5 microvolts if my estimations are accurate