Explanation:
the slope of f(x) = 1
for every increase of x by 1 also y increases by 1.
the slow of g(x) = -2
for every increase of x by one y decreases by 2.
so, we see, as
g(x) = k × f(x)
k = g(x) / f(x) = slope g / slope f = -2/1 = -2
why ? because both functions are linear functions (lines).
they look like
y = ax + b
with a being the slope of the line.
so, when multiplied by k, this is kax + kb, and we see k as factor already in the slope of the line itself.