1

Is there a way to find the maxima of the product of two log functions. I need to find the maxima of:

$f(x) = log\frac{1000}{x+k}.log(x+1) \text{, where k is a constant < 500, and } x \in [0,1000] \text{ such that } x+k \leq 1000$

It is getting overly complex trying to set its derivative to 0.

graph of the function looks like this.

Edit: Pl see the updated constraint on x and k.

sssam
  • 13
  • Do you mean $$\log(x+1)=\log_{e}{(x+1)}$$ – Dr. Sonnhard Graubner Oct 03 '18 at 18:35
  • Have you tried the product rule of differentiation? –  Oct 03 '18 at 18:45
  • @Dr. Sonnhard Graubner let's take the base as 2, since there are already answers posted using that. – sssam Oct 04 '18 at 05:22
  • @Brahadeesh yes I tried product rule; as mentioned in the question it became complex solving that way. – sssam Oct 04 '18 at 05:34
  • I don't think you would be able to write down the point of maximum precisely in terms of $k$. But in any case there are only finitely many values of $x$ you need to check since the function is initially increasing and then decreasing. So theoretically you can always find the integer at which the maximum is attained. –  Oct 04 '18 at 07:38
  • @Brahadeesh I would like to prove that for any $1< k <500$, the function has a maxima. Practically, I can always draw a graph to see that there is a maxima, but it would be nice if we could show it mathematically as well. – sssam Oct 04 '18 at 08:54
  • If you want to just prove that a maximum exists, then it is much easier. Finding the point of maximum in terms of $k$ is more difficult (and generally impossible, I believe). –  Oct 04 '18 at 08:56
  • I've added an answer showing how to prove that a maximum always exists. Let me know if it works for you. –  Oct 04 '18 at 09:05
  • Maybe you should correct the domain of function. If it belongs to positive integers then the function itself isn't continuous and differentiation is meaningless – Vinanth S Bharadwaj Oct 04 '18 at 12:06
  • @Vinath S Bharadwaj you are right. I will change the domain. – sssam Oct 04 '18 at 12:38
  • @VinanthSBharadwaj It's not much of a problem, since the function is differentiable as a map of real variables. Finding a real maximum and then checking the values of the closest integers will suffice. So changing the domain is not necessary unless the original problem itself was not about the integers at all. –  Oct 04 '18 at 13:12
  • I have removed the integer domain part. The problem I am solving is about integers but, as you said, it is fine to consider the domain of real numbers to get approximate result. – sssam Oct 05 '18 at 03:58

2 Answers2

1

You have $$f(x) = \log \left( \frac{1}{x+k} \right) \log \left( x+1 \right) = - \log(x+k)\log(x+1)$$

and $\log$ is an increasing function, so its maximum is attained for the smallest value of $x$, i.e. $x=1$, and its value is then $-\log(k+1) \log(2)$.

TheSilverDoe
  • 29,720
  • pl look at my edited question – sssam Oct 04 '18 at 05:28
  • @Brahadees Pl look at the image I added. The function is increasing first, and starts decreasing at x near 40. The first log is monotonically decreasing, whereas the second log is increasing. – sssam Oct 04 '18 at 07:11
0

Let $c = \log_2 1000$. Then $f(x) = c\log_2(x+1) - \log_2(x+k)\log_2(x+1)$. Differentiating and equating to zero, we get $$ \frac{c}{x+1} - \frac{\log_2(x+k)}{x+1} - \frac{\log_2(x+1)}{x+k} = 0 \implies c(x+k) = \log_2[(x+1)^{x+1}(x+k)^{x+k}] $$ The RHS is a monotonically increasing, concave-up function. So, the graphs of $$y=c(x+k) \quad \text{ and } \quad y = \log_2[(x+1)^{x+1}(x+k)^{x+k}]$$ intersect at most once. We also have that $$\lim_{x \to 0^+} f(x) = 0 \quad \text{ and } \quad \lim_{x \to +\infty} f(x) = -\infty,$$ and that $f(1) > 0$ when $k$ is in the range you mentioned ($1 < k < 500$). Hence, there is at least one critical point of $f$. Thus, there is a unique critical point, which will be the point of maximum of the function. Hence, a maximum always exists.