Integral identity proof 
Let $f(x)\in C[a,b]$ be a continuous function on the closed interval $a\le x\le b$ that satisfies $$ \int_a^b f(x)g''(x)dx = 0$$ for all $g(x)\in C^2[a,b]$ satisfying $$g(a)=g(b)=g'(a)=g'(b)=0.$$  Prove that  $f(x)=A+Bx$ for suitable constants $A$ and $B$.

I don't know where to start on this one.  I can't use integration by parts because the derivatives aren't guaranteed to exist.  I tried just plugging in $f(x)=A+Bx$ into the original as a way to possibly get a good function $g(x)$ to try to simplify this.  But that just leads to a very unhelpful $0=0$.  I also tried working backwards from $\int_a^b [f(x) - A - Bx]^2dx=0$ and seeing if I could get a good test function $g(x)$ from that.  But no success.
I assume I'm supposed to come up with a $g(x)$ that upon doing some algebra leads to something like $\int_a^b [f(x) - A - Bx]^2dx=0$, but I don't know which $g(x)$ to choose.
 A: Let $A,B$ be defined by \begin{align*} \int_a^b [f(x) - A - Bx] dx &= 0,\\ \int^b_a \int^x_a [f(\xi) - A - B\xi] d\xi dx &= 0.\end{align*} That is \begin{align*}\int^b_a f(x) dx &=(b-a)A + \frac{b^2 - a^2}{2} B, \\ 
\int^b_a \int^x_a f(\xi) \, d\xi \, dx &= \frac{(a - b)^2}{2} A + \frac{(2 a + b)(a-b)^2} 6 B. \end{align*} The right hand side gives a non-singular linear system for $A,B$ so $A,B$ are uniquely determined by these conditions. Then put $$g(x) = \int^x_a \int^\xi_a [f(t) - A - Bt] \, dt \, d\xi$$  so that $$g'(x) = \int^x_a [f(t) - A - Bt] \, dt, \,\,\,\,\,\,\,\,\,\,\,\,\, g''(x) = f(x) - A - Bx.$$ It is immediate from continuity of $f$, that $g \in C^2[a,b]$ and our coefficients $A,B$ were constructed specifically so that $g(b) = g'(b) = 0$ (it is also obvious that $g(a) = g'(a) = 0)$. We see\begin{align*} \int^b_a [f(x) - A - Bx] g''(x) dx  & =\int^b_a f(x) g''(x) dx - A \int^b_a g''(x) - B \int^a_b g''(x) dx \\&= \int^b_a f(x) g''(x) dx -A[g'(b) - g'(a)] +B \int^b_a g'(x) dx - B[bg'(b) - ag'(a)] \\ &= \int^b_a f(x) g''(x) dx -A[g'(b) - g'(a)] + B[g(b) - g(a)] - B[bg'(b) - ag'(a)].\end{align*} But every term in the above equation is zero [the first is zero by our assumption on $f$, the others are zero since $g(a) = g(b) = g'(a) = g'(b) = 0$]. Thus $$\int^b_a [f(x) - A - Bx] g''(x) dx =0.$$ Then using $g''(x) = f(x) - A - Bx$, we get $$0 = \int^b_a [f(x)-A-Bx] g''(x) dx = \int^b_a [f(x) - A - Bx]^2 dx.$$ Thus $f(x) - A- Bx = 0$ identically on $[a,b]$.
