The formula of a slope:
[tex]m=\dfrac{y_2-y_1}{x_2-x_1}[/tex]
We have m = 2 and the points (1, 2) and (3, y). Substitute:
[tex]\dfrac{y-2}{3-1}=2\\\\\dfrac{y-2}{2}=2\qquad\text{multiply both sides by 2}\\\\y-2=4\qquad\text{add 2 to both sides}\\\\\boxed{y=6}[/tex]