# Maximum of coefficients of a quadratic equation

Let $$f(x)=ax^2+bx+c$$ ($$a\ne 0$$) be a quadratic function. Given a specific $$n\in\mathbb N_+$$, $$f(x)$$ satisfies that for all $$x\in[-n,n]$$, $$|f(x)|\leq n$$. Find the maximum of $$|a|+|b|+|c|$$.

My initial guess is $$\frac{2}{n}+n$$ given the function $$f(x)=\frac{2}{n}x^2-n$$ satisfies the constraints above.

However, my best estimation is that $$|a|+|b|+|c|\leq \frac{2}{n}x^2+n+1$$ holds.

To justify this, consider the values of $$f(x)$$ where $$x=n,-n$$ and $$0$$. It will lead to a linear equation of $$a, b, c$$, which simplifies to

$$a=\frac{1}{2n^2}(f(n)+f(-n)-2f(0)), \quad b=\frac{1}{2n}(f(n)-f(-n)), \quad c=f(0).$$

However, using such estimation can only derive that

$$|a|+|b|+|c|=\left|\frac{1}{2n^2}(f(n)+f(-n)-2f(0))\right|+\left|\frac{1}{2n}(f(n)-f(-n))\right|+\left|f(0)\right|.$$

Using $$|f(x)|\leq n$$ and triangle inequality we can get

$$|a|+|b|+|c|=\left(\frac{1}{2n^2}+\frac{1}{2n}\right)\left(\left|f(n)\right|+\left|f(-n)\right|\right)+\left(\frac{2}{2n^2}+1\right)\left|f(0)\right|\leq n+\frac{2}{n}+1.$$

This is a constant away from the initial guess. Is there a better way of estimation? Or is it possible to construct a certain function whose sum of the absolute value of its coefficients is $$n+\frac{2}{n}+1$$? Any form of help would be appreciated.

• $n-x-\frac{1}{n}x^2$ doesn't go outside of the bounds for $x \in \{-n,0,n \}$, but does for other $x \in [-n,n]$. So that is nearly the strongest bound you can prove for the constraints you've identified, but there are additional constraints that you haven't made use of yet. Commented Jul 20 at 11:25

Hint:

WLOG, $$a\gt0$$. The constraints on $$a, b, c$$ are

$$\begin{cases}|an^2+bn+c|\le n\\|an^2-bn+c|\le n\\-n\le-\dfrac b{2a}\le n\implies\left|c-\dfrac{b^2}{4a}\right|\le n.\end{cases}$$

The relations are invariant to a change of sign of $$b$$, so WLOG $$b\ge0$$.

Note that we can rescale these unknowns and write

$$\begin{cases}|a'+b'+c'|\le n\\|a'-b'+c'|\le n\\-2a'\le-b'\le 2a'\implies\left|4a'c'-b'^2\right|\le 4na'.\end{cases}$$

The last constraint can be recast as three cases, two corresponding to a single plane (left member of the implication false), and the third corresponding to two planes and a quadric.

So you can solve by means of linear and quadratic programming. Not an easy task.

Amusingly, this can be solved without calculus.

First, we can assume wlog $$a,b>0$$ and $$c<0$$* so $$|a|+|b|+|c|=a+b-c$$. Clearly the maximum over the range is then at $$x=n$$. If $$n$$ isn't obtained anywhere in the range, $$a$$ could be increased, so $$an^2+bn+c=n \tag{❤️}$$

If $$-n$$ isn't obtained anywhere, $$c$$ can be decreased, so $$-n$$ is obtained. This could either be an internal minimum or a boundary solution at $$x=-n$$, giving us two cases:

In the boundary case, knowing $$f(-n)=-n$$ and $$f(n)=n$$ fixes $$a$$ and $$b$$, so we want to find the quadratic satisfying this that minimises $$c$$. Expanded around $$x=-n$$, $$f(x)=\alpha(x+n)^2+\beta(x+n)-n$$. Expanding out $$\alpha(x+n)^2+\beta(x+n)-n=ax^2+bx+c$$ we find $$a=\alpha$$, $$b=\beta+2n\alpha$$ and $$c= n^2\alpha + n\beta-n$$, so $$a+b-c$$ is decreasing in $$\beta$$ and decreasing $$\beta$$ helps rather than hinders us satisfying $$❤️$$, so we want $$\beta$$ to be as low as possible, which means $$\beta=0$$, as if $$\beta<0$$, $$x=-n$$ wouldn't be the minimum. This tells us that the minimum is at $$-n$$, so will actually be covered by our interior solution case.

Case 2: The minimum is interior and $$\le 0$$ so $$f(x)=\alpha(x+\mu)^2-c$$ for some $$\mu \in [0,n]$$. $$\alpha(x+\mu)^2-n=ax^2+bx+c$$ tells us that $$a=\alpha$$, $$b=2\alpha\mu$$ and $$c=\alpha \mu^2-n$$. By $$❤️$$ we have $$\alpha(n+\mu)^2-n=n$$ so $$a=\alpha=\frac{2n}{(n+\mu)^2}$$. Substituting this gives $$a+b-c=\frac{2n}{(n+\mu)^2}+\frac{4n\mu}{(n+\mu)^2}-\frac{2n\mu^2}{(n+\mu)^2}+n$$ The denominator has degree $$2$$, so we can minimise wrt $$\mu$$ without calculus, and we find $$\mu=\frac{n-1}{n+1}$$ if $$n \ge 1$$ and $$\mu=0$$ otherwise (as $$\mu \ge 0$$). We can then substitute $$\mu$$ to find $$\alpha=\frac{2n(n+1)^2}{(n-1)^4}$$ which in turn can be substituted into $$a+b-c=\alpha (1+2\mu-\mu^2)+n$$ to give something quite messy, which is our final answer, assuming my calculations are thus far correct. (Wolfram Alpha isn't loading for me and I don't want to do it by hand)

Sorry this is a bit of a mess, I'll try to come back and neaten it.

*We can make $$a>0$$ by flipping vertically, $$b>0$$ by flipping horizontally and if $$a$$ and $$c$$ have the same sign you can always switch $$c$$'s sign.

• Proceeding from your calculation, $a+b-c = \frac{n \left(n^2+2 n+3\right)}{n^2+2 n-1} = n+\frac{4 n}{n^2+2 n-1}$, which can be obtained when $a=\frac{2n(n+1)^2}{(n-1)^4}, b=\frac{4n(n+1)}{(n-1)^3},c=\frac{2n}{(n-1)^2}-n$. And this fits the constraints above. I really appreciate your help! Commented Jul 20 at 15:17
• Minor issue: it seems that your alterations towards $a, c$ might derive infinite alterations for changing $f(n)$ to $n$ might also affect $c$, so it seemed a little ambiguous. A better way might be rewriting $f$ into $a(x-x_0)^2+e$. Commented Jul 20 at 16:08
• "we can assume wlog $a,b>0$ and $c<0$": ok for $a,b>0$, but why $c<0$? Commented Jul 21 at 19:33
• @AnneBauval if $a$ and $c$ have the same sign you can always switch $c$'s sign. I guess that should be in the answer. Commented Jul 21 at 20:52
• A more obvious interpretation is that if $c>0$ then $|a|+|b|+|c|=f(1)\leqslant n$ which is smaller than $n+\frac{4n}{n^2+2n-1}$. Commented Jul 22 at 12:26

Remark 1. I let $$f(-b/(2a)) = -n$$ and $$f(n) = n$$ to maximize $$a + b - c$$ which gives the $$a, b, c$$ in Fact 1.

Remark 2. The $$a, b, c$$ in Fact 1 satisfies $$- \frac{b}{2a} = - \frac{n-1}{n+1} \in [-n, n]$$ if $$n\ge 1$$. When $$c < 0$$, the two values $$f(n), f(-\frac{n-1}{n+1})$$ are enough to imply the upper bound $$a + b - c \le n + \frac{4n}{n^2 + 2n - 1}$$.

$$\phantom{2}$$

Fact 1. Let $$f(x) := ax^2 + bx + c$$ ($$a \ne 0$$) be a quadratic function. Given $$n \in \mathbb{R}_{\ge 1}$$, $$f(x)$$ satisfies $$|f(x)| \le n$$ for all $$x\in [-n, n]$$. Then the maximum of $$|a| + |b| + |c|$$ is given by $$n + \frac{4n}{n^2 + 2n - 1}$$, when (e.g.) $$a = \frac{2n(n + 1)^2}{(n^2 + 2n - 1)^2}, \quad b = \frac{4n(n^2 - 1)}{(n^2 + 2n - 1)^2}, \quad c = - \frac{n(n^4 + 4n^3 - 1)}{(n^2 + 2n - 1)^2}.$$

Fact 2. Let $$f(x) := ax^2 + bx + c$$ ($$a \ne 0$$) be a quadratic function. Given $$n \in (0, 1)$$, $$f(x)$$ satisfies $$|f(x)| \le n$$ for all $$x\in [-n, n]$$. Then the maximum of $$|a| + |b| + |c|$$ is given by $$\frac{2}{n} + n$$ when e.g. $$f(x) = \frac{2}n x^2 - n$$.

$$\phantom{2}$$

Proof of Fact 1.

WLOG, assume that $$a > 0$$ and $$b \ge 0$$. We split into two cases.

Case 1. $$c \ge 0$$

We have $$|a| + |b| + |c| = a + b + c \le an^2 + bn + c = f(n) \le n < n + \frac{4n}{n^2 + 2n - 1}$$.

Case 2. $$c < 0$$

Since $$-\frac{n-1}{n+1} \in [-n, n]$$, we have $$- f(-\frac{n-1}{n+1}) \le n$$. We have \begin{align*} |a| + |b| + |c| &= a + b - c\\ &= \frac{(n+1)^2}{n^2+2n-1}\cdot \left[- f\left(-\frac{n-1}{n+1}\right)\right] + \frac{2}{n^2+2n-1}\cdot f(n)\\ &\le \frac{(n+1)^2}{n^2+2n-1}\cdot n + \frac{2}{n^2+2n-1}\cdot n\\ &= n + \frac{4n}{n^2 + 2n - 1}. \end{align*}

We are done.

$$\phantom{2}$$

Proof of Fact 2.

WLOG, assume that $$a > 0$$ and $$b \ge 0$$. We split into two cases.

Case 1. $$c \ge 0$$

Since $$f(n) = an^2 + bn + c \le n$$, we have $$a + b/n + c/n^2 \le 1/n$$. Thus, we have $$|a| + |b| + |c| = a + b + c \le a + b/n + c/n^2 \le \frac{1}{n} < \frac{2}{n} + n.$$

Case 2. $$c < 0$$

We have \begin{align*} |a| + |b| + |c| &= a + b - c\\ &= \frac{n+1}{2n^2}\cdot f(n) + \frac{1-n}{2n^2}\cdot f(-n) + \frac{n^2+1}{n^2}\cdot [-f(0)]\\ &\le \frac{n+1}{2n^2}\cdot n + \frac{1-n}{2n^2}\cdot n + \frac{n^2+1}{n^2}\cdot n\\ &= \frac{2}{n} + n. \end{align*}

We are done.

(UPDATE: The solution given by user @River Li (Fact 1), appears to check out, so treat the following elaborations as having somewhere some mistake.)

Let's see if the following make sense.

I will use the sign function $$s(z) \equiv \begin{cases} -1 & z<0 \\ 0 & z=0 \\ 1 & z>0 \end{cases}$$

It would appear that we can formulate the problem as

$$\max_{(|a|,|b|,|c|)} V \equiv |a|+|b|+|c|$$

$$s.t.\quad a \neq 0,\quad |b|\geq 0, \quad |c|\geq 0,$$ $$\quad f=\Big|s(a)|a|x^2 + s(b)|b|x + s(c)|c|\Big| \leq n, \quad x\in [-n, n].$$

The Lagrangean is, with non-negative KKT multipliers,

$$\Lambda = |a|+|b|+|c| + \lambda\cdot \left(n-\Big|s(a)|a|x^2 + s(b)|b|x + s(c)|c|\Big|\right) +\mu_b|b| +\mu_c|c|.$$

Then, at the optimum, if it exists and denoted by a star ($$*$$)

$$\frac{\partial \Lambda}{\partial |a|} = 0 \implies 1 = \lambda^*\cdot s(f^*)\cdot s(a^*)\cdot (x^*)^2 \tag{1}$$

$$\frac{\partial \Lambda}{\partial |b|} = 0 \implies 1+\mu_b = \lambda^*\cdot s(f^*)\cdot s(b^*)\cdot x^* \tag{2}$$

$$\frac{\partial \Lambda}{\partial |c|} = 0 \implies 1+\mu_c = \lambda^*\cdot s(f^*)\cdot s(c^*). \tag{3}$$

From $$(1)$$ we learn : $$\lambda^* > 0$$ so the constraint is binding and at the maximum we will have $$|f^*|=n \tag{4}$$

Also, we learn that the sign of $$a^*$$ will be the same as the sign of $$f^*$$ $$\implies s(f^*)\cdot s(a^*) =1 \tag{5}$$

...which also implies that $$f^* \neq 0$$ (which is good because the derivative of its absolute value does not exist at $$f=0$$).

We also learn that the maximum won't happen at $$x=0$$.

From $$(2)$$ we learn that

$$s(b^*)\neq 0 \implies b^* \neq 0 \implies \mu_b =0 \tag {6}$$

From $$(3)$$ we learn

$$s(c^*)\neq 0 \implies c^* \neq 0 \implies \mu_c =0 \tag {7}$$

and that

$$s(f^*) = s(c^*)\implies s(f^*) \cdot s(c^*)=1. \tag{8}$$

Collecting results and their consequences, at the optimum the conditions will be

$$1 = \lambda^*\cdot (x^*)^2 \tag{1a}$$

$$1 = \lambda^*\cdot s(f^*)\cdot s(b^*)\cdot x^* \tag{2a}$$

$$1 = \lambda^*. \tag{3a}$$

which in turn imply

$$|x^*| =1 \tag{9}$$

$$s(f^*)\cdot s(b^*)\cdot x^* = 1 \tag{10}.$$

CASE $$1$$: $$x^*=1$$.

Then from $$(10)$$ we have $$s(f^*)= s(b^*)$$ so all three $$a,b,c$$ will have the same sign, say $$s^*$$.

Then, since, from $$(4)$$, $$|f^*| = n \implies \Big | s^* |a_1^*| + s^* |b_1^*| + s^* |c_1^*| \Big| = n \implies |a_1^*| + |b_1^*| + |c_1^*| = n = V^*_1\tag {11}$$

This is one possible solution.

CASE $$2$$: $$x^*=-1$$.

Here, again due to $$(10)$$, the sign of $$b$$ will be the opposite of the sign of $$f, a,c$$, but also $$x=-1$$ so we have

$$|f^*| = n \implies \Big | s^* |a_2^*| - s^* |b_2^*|\cdot (-1) + s^* |c_2^*| \Big| = n$$

which gives us exactly the same condition as in case 1. So it appears we have arrived at the possibility that

The maximum of $$|a| + |b| + |c|$$ is equal to $$n$$ and it will happen at $$|x|=1$$.