why check all primes under the root of an interger? I am in high school and I need to factorize numbers. My teacher told me to check all numbers which are smaller than the root of the number I want to factorize. This seems to work just fine, but I do not know why it works and neither does my teacher.
Is there someone here who knows why this trick works?

First, you need only check the prime numbers less than $\sqrt n$, for the number $n$ that you are trying to factorize. 
Why? If you find a composite number that goes into $n$, all of that composite number's prime factors will also go into $n$ (basically, if $p$ divides $a$ and $a$ divides $n$, then $p$ divides $n$). 

Now as for why we are checking (prime) numbers less than $\sqrt n$, that is because each factor of $n$ that is less than $\sqrt n$ will correspond to one factor that is greater than $\sqrt n$. (Imagine if we had a factorization $n = a \cdot b$, where both $a$ and $b$ are less than $\sqrt n$. Then their product would ALSO be less than - and not equal to! - $n$)
Indeed, you could switch your method to just testing primes that are greater than $\sqrt n$, but we usually do it with smaller numbers, as those are easier to check. 
