<s>[INST] Finding x which maximizes the volume of any cuboid missing one side So my grandpa and me where doing some maths for fun and we stumbled upon this problem:
Given a rectangle with unknown sidelenghts a and b, we need to cut off a square in each corner (call the side length of the square x) so that we get a net of a cuboid missing one side:
the problem:
The goal is to choose x such that we maximize the volume of this cuboid.
This was my idea:
$$V= (a-2x)(b-2x)*x $$ $$= 4x^3 - 2 ax^2 -2bx^2 + abx$$
now we differentiate in respect to x:
$$\frac{d}{dx} (4x^3 - 2 ax^2 -2bx^2 + abx)$$
$$=12x^2-4ax -4bx + ab$$
$$=12x^2-(4a+4b)x + ab$$
using the quadratic formula:
$$x_{1,2}=\frac{-(-(4a+4b) \pm \sqrt{(-(4a+4b))^2-4*12*ab}}{2ab}$$
$$x_{1,2}=\frac{(4a+4b) \pm \sqrt{16a^2+32ab+16b^2-48ab}}{2ab}$$
$$x_{1,2}=\frac{(4a+4b) \pm \sqrt{16a^2-16ab+16b^2}}{2ab}$$
$$x_{1,2}=\frac{4(a+b) \pm \sqrt{16(a^2-ab+b^2)}}{2ab}$$
$$x_{1,2}=\frac{4(a+b) \pm 4\sqrt{(a^2-ab+b^2)}}{2ab}$$
$$x_{1,2}=\frac{2(a+b) \pm 2\sqrt{(a^2-ab+b^2)}}{ab}$$
$$x_{1,2}=\frac{2(a + b \pm \sqrt{(a^2-ab+b^2)})}{ab}$$
Before calculating further I checked the solutions for x in Wolfram Alpha and it gave me this result (which is correct):
$$x_{1,2}= \frac{1}{6}(\pm\sqrt{a^2-ab+b^2}+a+b)$$
My solution is obviously incorrect, but I don't quite get what's wrong with my approach. I'm pretty sure that i calculated everything right. Am I not allowed to use the quadratic formula in that case, or what am I missing? Can somebody explain?
 [/INST] Why $x_{1,2}=\frac{-(-(4a+4b) \pm \sqrt{(-(4a+4b))^2-4\cdot12\cdot ab}}{2ab}$? You  made a serious mistake since using the root fomula of quadratic equation.
Since the equation is $12x^2-4(a+b)x+ab=0$, so...
$$
x_{1,2}=\frac{-(-4(a+b))\pm\sqrt{(-4(a+b))^2-4\cdot12\cdot ab}}{2\cdot12}
\\
=\frac{a+b\pm\sqrt{a^2-ab+b^2}}{6}
$$
</s>