Consider the function
f(x)= ax^2 if x>a
f(x)= ax+2a if x
where a is some number.
What is the largest value of a such that the graph of y= f(x) intersects every horizontal line at least once?
For x < a, the graph of y = f(x) is the same as the graph of y = ax+2a, which is a line with slope a and which passes through the point (a, a^2+2a). For \(x \ge a\), the graph of y = f(x) is the same as the graph of y = ax^2, which is a parabola passing through the point (a, a^3). Notice that the parabola only ever takes nonnegative values. Therefore, the line portion of the graph must have positive slope, because it must intersect horizontal lines which lie below the $x-$axis. Thus, $a > 0.$ For $a > 0,$ the line portion of the graph passes through all horizontal lines with height less than or equal to $a^2+2a,$ and the parabola portion of the graph passes through all horizontal lines with height greater than or equal to $a^3.$ Therefore, all horizontal lines are covered if and only if \(a^2 + 2a \ge a^3.\) Since a > 0, we can divide by a to get a\( + 2 \ge a^2\), so \(0 \ge a^2 - a - 2 = (a-2) ( a+1)\). This means that \(-1 \le a \le 2,\) so the greatest possible value of a is \(\boxed{2}\).