# The value of $x$ for which function attains max value

At what value of $x,\ x\in \mathbb{Z}$ will the function $\dfrac{x^2+3x+1}{x^2-3x+1}$ attain its maximum value .

$\color{green}{a.)\ 3 }\\ b.)\ 4 \\ c.) -3 \\ d.)\ \text{none of these} \\$

$\dfrac{x^2+3x+1}{x^2-3x+1}\\ =1+\dfrac{6x}{x^2-3x+1}\\ =1+\dfrac{6}{x-3+\frac{1}{x}}\\$

here i thought to use $\text{AM-GM}$ inequality for the part $x+\dfrac{1}{x}$

and concluded that $x+\dfrac{1}{x}=2 \implies x=1$

But after inspecting some values i came up with

$$\begin{array}{|c|c|} \hline x & k \\ \hline -4 & \dfrac{5}{29} \\ \hline -3 & \dfrac{1}{19} \\ \hline -2 & -\dfrac{1}{11} \\ \hline -1 & -\dfrac{1}{5} \\ \hline 0 & 1 \\ \hline 1 & -5 \\ \hline 2 & -11 \\ \hline \color{green}{3 }& \color{red}{19} \\ \hline 4 &\dfrac{29}{5}\\ \hline \end{array}$$

I look for a short and simple way .

also i don't want to use calculus.

I have studied maths up to $12$th grade.

• Yes, local minimum maximum, at $x = -1, 1$ and $y = -3/5,-5$ respy. – Narasimham Jun 27 '15 at 12:44

Your last two formulas for $f(x)$ in your first edit are incorrect: they should be

$$f(x)=1+\frac{6x}{x^2-3x+1}=1+\frac{6}{x-3+\frac{1}{x}}$$

(I see you corrected that formula in your question by a later edit.)

You maximize that by making the denominator positive but as small as possible. The $-3$ in that denominator means that you make $x=3$. Any smaller, and the denominator becomes negative. Any bigger, and the denominator becomes bigger and reduces the value of the function.

Nothing fancy was needed here. The AM-GM inequality shows that $x+\frac 1x$ has a minimum of $2$, but that makes the denominator negative and is thus not relevant here. You want to make $x+\frac 1x$ just above $3$, and that is done at $x=3$.

Here is another way to look at it. If $x$ can be any real number, your function $f(x)$ has no maximum. It tends to infinity as the denominator tends to zero. We can solve the quadratic equation of the denominator equaling zero and get

$$x=\frac{3\pm\sqrt 5}{2}\approx 0.38,\ 2.62$$

We get a positive denominator for $x<0.38$ and $x>2.62$ (approximations used here).

We still want a small positive denominator, so if we limit $x$ to integers we now look at $x=0$ (below 0.38) and $x=3$ (above 2.62). We see that $x=3$ gives us the larger value, so that gives us the maximum for all integers.