Why is the second derivative of this function a straight line?
Suppose the second derivative of a function is a straight line:
$$f''(x)=ax+b$$
It follows that
$$f'(x)=\frac12ax^2+bx+c$$
$$f(x)=\frac16ax^3+\frac12bx^2+cx+d$$
So the only functions that have their second derivatives as straight lines are polynomials degree $3$ or lower.
Now, for some insight, let's just worry about the first derivative of $x^2$, which is obviously $2x$, but I wish to make it more intuitive:
Rather than letting $h\to0$, we fix $h=1$ and just take finite differences. It is easy enough to see then that $(x+1)^2-x^2=2x+1=1+\frac d{dx}x^2$.
Similarly, if we apply a finite difference on $x^3$ 2 times, which is analogous to the second derivative, we get
$$(x+1)^3-x^3=3x^2+3x+1$$
$$3(x+1)^2+3(x+1)+1-3x^2-3x-1=6x+6=6+\frac{d^2}{dx^2}x^3$$
Indeed, you should be able to prove by induction that the $n$th derivative of a polynomial degree $n+1$ is linear.
And as a last comment, usually, when we have $h\to0$, all the left-over constants and such go to $0$.
I think you are confused. The second derivative of any arbitrary function will not necessarily be a straight line. For instance, the exponential $f(x) = e^x$ has second derivative $f''(x) = e^x$ which is clearly not linear. It is possible to come up with linear approximations in a neighborhood of a point, and 3rd-degree polynomials of the form $g(x) = ax^3 + bx^2 + cx + d$ will always have second derivatives that are straight lines. But for arbitrary functions this is not the case in general.
I understand this is math.stackexchange, so the answers that have already been put up are certainly sound. However, you said you were looking for something a little more intuitive.
The derivative of a function just describes the slope of that function. When the function is increasing, its slope (derivative) will be positive. When it is increasing "faster", its derivative will be more positive. Similarly - when the function is decreasing, its derivative will be negative.
The diagram you posted has dotted lines drawn from the top curve at inflection points, where the slope changes from positive to negative. Notice how they're drawn downwards to the middle curve (the parabola) exactly where it crosses the x-axis.
The derivative of the parabola is negative while the parabola is decreasing, and positive while increasing. That alone doesn't guarantee a straight line:
$$f(x) = x^4$$ is very "parabola" shaped, and from initial inspection you may expect it to be a parabola, but the derivative ends up being cubic: $$f'(x) = 4x^3.$$
The second derivative is not guaranteed to be a straight line for any arbitrary function $f(x)$; it just describes the "slope of the slope" of that function.
I will make an attempt to respond to this part:
is there also an intuitive answer to it?
Recall that the derivative of a function [is a function that] takes an $x$-value as its input, considers the tangent line drawn at that $x$-value, and gives the slope of that tangent line as its output.
Looking at the first picture, you have two turning points, so you will need a derivative that has two zeroes. You can also see that the function, while initially increasing (so: positive slopes of the tangent lines), is doing so at a decreasing rate till it reaches its vertex (so: tangent lines get less steep till their slope reaches zero). Afterwards, the function is decreasing (so: negative slopes of the tangent lines) pretty fast until your middle dotted line, at which point it continues to decrease (so: tangent line slopes are still negative) but not quite as quickly as it approaches the next vertex (where the tangent line's slope is again zero).
That is all a bit wordy, but the same sort of idea can be carried out in looking at the second image. It has one vertex (so: its derivative should be equal to zero only once) and goes from very negative tangent line slopes to very large positive tangent line slopes (so: a straight line seems to be a good candidate).
I happen to think that considering a quadratic function written in standard form, $ax^2 + bx + c$, and recalling that its vertex occurs when $x = -b/2a$, is enough to guess (using one's intuition) not only that the derivative would correspond to a linear function, but that, in particular, the derivative is $2ax + b$. I wrote up this idea and put it as the second example in the following article, published in a journal of mathematics education, which you may (or may not) find of interest:
Dickman, B. (2016). Looking Back to Support Problem Solving. Mathematics Teacher, 110(1), 54-58. Link (no paywall).
Let's talk only about intuition.
If you look at your function $f(x)$, you'll notice that there are regions where it's value increases and other where the value decreases. Since the function is continuous, at some point it should stop increasing. That's what the first derivative tells you: if $f'(x)$ is positive, then the value of $f(x)$ increases as $x$ increases, if $f'(x)$ is negative, then the value of $f(x)$ decreases as $x$ increases, and if $f'(x)=0$ then the function is not increasing not decreasing; i.e. the slope of $f(x)$ is zero.
Now, if your function is continuous and has intervals where it's value increases and intervals where it's value decreases, it's reasonable to think that the rate at which it's value increases/decreases changes, and that's given by to second derivative. In particular, when $f''(x)>0$ and $f'(x)>0$, the rate at which the value increases is faster, and if $f''(x)>0$ and $f'(x)>0$, the rate at which the value increases is slower (see for yourself what happens when $f'(x)<0)$. And when $f''(x)=0$, you have an inflection point, where the rate of increase/decrease of the function value changes from faster to slower or vice-versa.
Now, your particular example:
Your $f(x)$ plot shows a function with one local maximum and one local minimum, and you can expect that at such points $f'(x)=0$. And it turns out that your $f'(x)$ plot has one (absolute) minimum, so $f(x)$ should have an inflection point. It makes sense: your function reaches a local maximum and starts decreasing and then reaches a local minimum and starts increasing; at some point between maximum and minimum the "speed" at which the function decreases has to slow down: that point is the inflection point, where $f''(x)=0$.
Finally, the second derivative being a straight line requires to see all plots together:
- $f'(x)<0$ and $f''(x)>0$: slope is positive and rate of change is negative: speed of change is slowing
- $f'(x)=0$ and $f''(x)<0$: local maximum
- $f'(x)<0$ and $f''(x)<0$: slope is negative and rate of change is negative: speed of change is accelerating
- $f'(x)<0$ and $f''(x)=0$: slope is negative and rate of change is zero: speed of change starts to slow down
- $f'(x)<0$ and $f''(x)>0$: slope is negative and rate of change is positive: speed of change is accelerating
- $f'(x)=0$ and $f''(x)>0$: local minimum
- $f'(x)>0$ and $f''(x)>0$: slope is positive and rate of change is positive: speed of change is accelerating
As noted in other answers, the only functions that have a straight line as a second derivatives are polynomials of degree 3 or less. Let me add that a non-zero slope for a straight line second derivative implies that the degree of the polynomial must be exactly 3.