Given:
y varies directly as x.
When x=10, y=20.
Since y varies directly as x, the relation between x and y can be written as,

Here, k is a constant.
Since y=20, when x=10, substitute x=10 and y =20 in the above equation to find the constant k.

Therefore, the equation of variation can be written as,

Therefore, the equation of variation in which y varies directly as x is y=2x.
Now to find the value of y when x =20, substitute x=20 and k=2 in equation (1).

Therefore, when x=20,the value of y is 40.