x and y are directly related. Therefore, y=k*x, where k is the constant that they're directly related by.
You use the given set of x and y to find k:
To solve for k, you divide 18 on both sides, getting k=1/3.
k is a constant, so it's value doesn't change even if y and/or x change. Therefore, you can solve for y by using the equation y=k*x again. Plug in the value we found for k and the (given) value of x that corresponds to the value of y you want to find:
solve this to get y=7