to get the equation of any line you need two things:
the slope of the line and any point passes by the line
here we have two points passes by the line ( 0,2) (4,0)
by knowing those two points we can get the slope easily as follow
slope (m) = (0-2) / (4-0)
so m = -1/2
now we have the slope and point (0,2)
the general equation of the line is y = mx +c
where m is the slope and c is a constant.
so the equation will be y = -1/2 x + c
and to get the value of the constant, sub by the point (0,2) in the pervious equation
that will be 2 = -1/2 (0) + c
then c = 2
now the final equation of the line will be y = -1/2 x + 2
to make the equation look better, multiply it by 2 and move x to the left-hand side
2y + x = 4