<s>[INST] Integration to minimize area I have the following problem:
Given a line $f(x) = ax + b$ which passes trough the point $(1, 2)$, find the values for $a$ and $b$ which results in the minimum value for $\int_{-1}^{1}(ax + b)^2\mathrm{d}x$. I already know the result of the area will be $\dfrac{2a^3}{3} + 2b$. But I don't even know how to start cause there are infinite infinite number of different $a, b$ which passes though this point.
How to start ?
 [/INST] Firstly, the result of the integration is incorrect:
\begin{align*}
\int_{-1}^1 (ax+b)^2\ dx &= \int_{-1}^1 a^2x^2+2abx+b^2 \ dx \\
 &=\left[ \frac{a^2}{3}x^3+abx^2+b^2x \right]_{-1}^1 \\
 &=\frac{a^2}{3}1^3+ab \cdot 1^2+b^2 1 - \left( \frac{a^2}{3}(-1)^3+ab(-1)^2+b^2 (-1) \right) \\
 &=\tfrac{2}{3}(a^2+3b^2).
\end{align*}
Now, using the point $(1,2)$, we can find an equation for $b$ in terms of $a$, namely $b=2-a$ (since $f(x)=ax+b$).  Thus the area is $$\tfrac{2}{3}(a^2+3(2-a)^2).$$
Now the minimum area is when $$g(x):=\tfrac{2}{3}(x^2+3(2-x)^2)$$ is minimized.  We can find this minimum by using the usual process of differentiating and equating to zero.
</s>