So here's the problem:The complete graph of $y=f(x),$ which consists of five line segments, is shown in red below. (On this graph, the distance between grid lines is $1.$)
Let $a$ and $b$ be the largest negative integer and the smallest positive integer, respectively, such that the functions $g(x)=f(x)+ax$ and $h(x)=f(x)+bx$ are invertible. What is $a^2+b^2?$
So obviously this graph isn't invertible (using the horizantal line test). But how do I make it invertible? Any help would be great.

$f(x)$ itself isn't invertible, but if you add a function to it that increases faster than it ever decreases, or decreases faster than it ever increases, then the rises and drops of $f(x)$ are not enough to make the sum function change directions. So the sum would still be invertible.
So you just have to figure out how fast that $ax$ has to fall, and $bx$ has to rise to overcome the reversals in $f(x)$. For that, note that if you have two lines $y = m_1x + b_1$ and $y = m_2x+b_2$, then their sum is the line $$y = (m_1+m_2)x + (b_1+b_2)$$ What is required of that sum for it to be invertible?