The trick used to represent the roots on the number line is of Pythagoras theorem.According to it-
H2=B2+P2
so if we take base as 2 and perpendicular as 2 we get,
H2=22+22
H2=4+4
H2=8
H=root 8
Then by taking the legth of the hypotenuse as radius with the help of a compass you can cut an arc on the number line.