A simple method to calculate minimal area enclosed between a tangent to $f(x)$ and coordinate axes Given a function $y=f(x)$, take a tangent to the function at some point. We are to find the minimum area between this line and the coordinate axes. An example question is the coordinate axes have minimum area.
I faced two different algorithms to find the solution. The first one is straight-forward:

*

*Pick a point on the function: $(x_1, y_1) = (x_1, f(x_1))$.

*Find the derivative of the function at $x_1$ to calculate the slope of the line. ($m=f'(x_1)$)

*Derive the tangent-line formula. $y-y_1=m(x-x_1)$

*Find the formulations of intersections with coordinate axes $(0, y_0)$, $(x_0, 0)$.

*Calculate the formulation of the area of triangle as $A = x_0 y_0/2$.

*$A$ shall be a function of $x_1$, minimize that to calculate minimum area.

Second algorithm is very short compared to that:

*

*Take the function $g(x) = 2 x f(x)$.

*Minimize that function to calculate the result.

I cannot figure out how the second algorithm works, or when it works. I checked both against the following family of functions, and both algorithms give the same result:

*

*$f(x) = ax+b$

*$f(x) = k/x$

*$f(x) = 3b^2 - a^2 x^2$

*$f(x) = \frac{b}{a} \sqrt{a^2-x^2}$
Question is: Can we prove/disprove the second algorithm? If disproved, under what conditions does the second algorithm work?
 A: $\def\x{\tilde x}$
Observe that all your examples except for $f(x)=ax+b$ have the following common properties. In the first quadrant they are:
$$\begin{align}&\text{positive and decreasing}\tag1\\ 
 &\text{either concave or convex}\tag2
\end{align}$$
Let $(x,f(x))$ be the tangency point. Then the area of the triangle in question is:
$$
A(x)=-\frac{(xf'(x)-f(x))^2}{2f'(x)}.\tag3
$$
Hence the equation $A'(x)=0$ reads:
$$
\frac{[xf'(x)-f(x)]f''(x)[xf'(x)+f(x)]}{2(f'(x))^2}=0.\tag4
$$
Since due to properties (1) and (2) neither the first nor the second factor in the numerator can be $0$, we are left with the equation:
$$
0=xf'(x)+f(x)=[xf(x)]',\tag5
$$
so that the extrema of the functions $A(x)$ and $xf(x)$ are attained at the same point $\x$. Substituting $\x f'(\x)=-f(\x)$ into equation (3) one finally obtains that the extreme area is:
$$
A(\x)=2\x f(\x)\tag6
$$
in agreement with the claim.
A: We know that it cannot be correct to minimize the product $2x f(x)$
in order to minimize the area between the coordinate axes and the curve
$y = f(x)$ in the first quadrant, because the product $2x f(x)$ is zero when
$x=0$ and when $f(x) = 0$ and is positive everywhere else in the first quadrant.
Hence it has no minimum in the first quadrant except at those two points,
and we can easily show by example that the tangent enclosing the minimum area
is not always tangent to $y = f(x)$ where it intercepts a coordinate axis.
But let's see what method is correct.
Consider the curve $xy = k$ in the first quadrant.
The value at $x = a$ is $\frac ka$ and the slope is $-\frac k{a^2}.$
The tangent line therefore is $y - \frac ka = -\frac k{a^2}(x - a),$  which has $y$-intercept $\frac{2k}a$ and $x$-intercept $2a.$
The area bounded by this line and the two axes therefore is
$\frac12 \left(\frac{2k}a\right)(2a) = 2k,$
independent of the choice of tangent point $\left(a,\frac ka\right).$
Now consider a function $f$ on the interval $[0,x_0]$,
whose graph $y=f(x)$ connects the points $(0,y_0)$ and $(x_0,0)$,
and which is positive and has a decreasing derivative on the interval $(0,x_0).$
At any $x$ between $0$ and $x_0,$ if we take a line tangent to the graph of $f$
at $(x,f(x)),$ the graph of $f$ is below that tangent line at every other point.
The graph of $f$ between $(0,y_0)$ and $(x_0,0)$
intersects curves of the form $xy = k$ for many values of $k$;
let $m$ be the maximum such value of $k$.
Then the graph of $f$ will meet the graph of $xy = m$ at exactly one point,
$(x_m,f(x_m)),$
where the two graphs will be tangent to each other.
The area between the axes and the line tangent to the two graphs at that point
has area $2m.$
Now consider any other value of $x$ in the interval $[0,x_0]$
and take a line tangent to the graph of $f$ at $(x,f(x)).$
This tangent line passes above the point $(x_m,f(x_m)),$
so it also passes above the graph of $xy = m$ at that point.
This line is tangent to a graph of $xy = k$ for some $k > m$,
so the area between that line and the axes is greater than $2m.$
So the area under the tangent to the graph of $f$ is minimized at the point where the graph of $f$ is tangent to the graph of $xy = m$.
Moreover, $m$ is the maximum value of $xy$ at any point on the curve $y = f(x)$.
So the way to minimize the area between the axes and the tangent to the curve
$y = f(x)$ is to maximize (not minimize!) the product $xy = x f(x)$ for
$x$ between $0$ and $x_0.$
Naturally this also maximizes $2x f(x),$ and that maximum value also happens to be the minimum area between the axes and any tangent to the graph of $f.$
The reason it seems OK to try to minimize the product $2x f(x)$
is that the "obvious" way to minimize $2x f(x)$ in the first quadrant (if you forget how the minimum actually occurs) is to find the value of $x$ for which
$\frac{\mathrm d}{\mathrm dx} (2x f(x)) = 0,$
and this happens actually to be the value of $x$ that maximizes $2x f(x).$
A: Alternative proof with Lagrange Multipliers.
If $y=a(x)$, then, equivalently, we have a constraint function in x and y, $f(x,y)=y-a(x)=0$. So if $y=4-x^2$, $f(x,y)=y-4x^2=0$.
The slope of the tangent line to an arbitrary $f(x,y)$ is $m=\frac{-\delta f / \delta x}{\delta f / \delta y}$.
From above $\delta f/ \delta y =1$, and $\delta f / \delta x = -da/dx$.
Also: $\frac{\delta^2 f}{\delta x \delta y}=\frac{\delta ^2 f}{\delta y^2}=0. $
Area is:
$$A = \frac{(y+x\frac{\delta f / \delta x}{\delta f / \delta y})^2}{2}\frac{\delta f / \delta y}{\delta f / \delta x}$$
Cleaning up:
$$A = \frac{ (y\frac{\delta f}{\delta y}+x\frac{\delta f }{\delta x})^2  }{2\frac{\delta f}{\delta x}\frac{\delta f }{\delta y}}=\frac{(y+x \frac{\delta f}{\delta x})^2}{2 \frac{\delta f}{\delta x}}$$
$$A_x = \frac{2 \frac{\delta f}{\delta x}\cdot 2\cdot(y+x \frac{\delta f}{\delta x})(\frac{\delta f}{\delta x}+x\frac{\delta ^2f}{\delta x^2})-2\cdot \frac{\delta ^2 f}{\delta x^2}(y+x\frac{\delta f}{\delta x})^2 }{4(\frac{\delta f}{\delta x})^2}=y+x\frac{\delta f}{\delta x}-\frac{y^2 \frac{\delta ^2 f}{\delta x^2}}{2 (\frac{\delta f}{\delta x})^2}+\frac{x^2\frac{\delta ^2 f}{\delta x^2}}{2}$$
$$A_y =\frac{4\frac{\delta f}{\delta x}(y+x\frac{\delta f}{\delta x})(1+x\cdot \frac{\delta ^2 f}{\delta x \delta y})-2\frac{\delta ^2f}{\delta x \delta y}(y\frac{\delta f}{\delta y}+x\frac{\delta f}{\delta x})}{4(\frac{\delta f}{\delta x})^2} =\frac{y+x\frac{\delta f}{\delta x}}{ \frac{\delta f}{\delta x}}$$
By Lagrange Multipliers, $\lambda f_x=A_x$ and $\lambda f_y = A_y$
$f_y=1$, so $\lambda=\frac{y+x \frac{\delta f}{\delta x}}{\delta f/ \delta x} $, and $\lambda f_x=y+x\frac{\delta f}{\delta x}=y+x\frac{\delta f}{\delta x}-\frac{y^2 \frac{\delta ^2 f}{\delta x^2}}{2 (\frac{\delta f}{\delta x})^2}+\frac{x^2\frac{\delta ^2 f}{\delta x^2}}{2}$
So:
$$0=-\frac{y^2 \frac{\delta ^2 f}{\delta x^2}}{2 (\frac{\delta f}{\delta x})^2}+\frac{x^2\frac{\delta ^2 f}{\delta x^2}}{2}$$
And:
$$(x\frac{\delta f}{\delta x}-y)(x\frac{\delta f}{\delta x}+y)=0$$
If the second term is zero, we have zero area, so set the first term to zero.
But, $\frac{\delta f}{\delta x}=-\frac{dy}{dx}$, so $(x\frac{\delta f}{\delta x}-y)=0 \implies \frac{d(xy)}{dx}=0$
Since $y=x\frac{\delta f}{\delta x}$, $A=2x^2\frac{\delta f}{\delta x}=2xy$
