The general form of the equation of a line is:
y=mx+b
Where m is the slope of the line and b is the intercept with the y axis.
Since the intercept is the point where the line intersects the y-axis, if a line goes through the origin, then is intercept equals 0, b = 0, which is the case for the first and last line, then, their equation looks like this:
y=mx
When the slope (m) is a positive number, the line goes up as x increases, when the slope (m) is negative, the line goes down as x increases, then the equation of the first line must be: y=x and y= -x for the last line.
For the second line, we can see that it crosses he axis at y= -3, then its intercept equals -3, that's why the equation of this line is y = x - 3