Lets say we have a funktion $f(x) = -(x-2)^2 + 3$, which has a global maximum at $x_0=2$ with $f(x_0)=3$.

This means that $\max(f) = 3$. $\arg\!\max$ answers not how high the maximum is, but where it occurs: $\arg\!\max(f) = 2$.

Note that $f(\arg\!\max(f)) = \max(f)$.


In general $$x^*=\arg \max_x f(x) $$ means return $x$ that maximizes $f(x)$.

How to find $x^*$? 1) Find $f(x)$ for all possible values of $x$ as $\{x_n,\,f(x_n)\}$. 2) Find the maximum value of $f(x)$ in the set $\{f(x_n)\}$, let's denote it by $f(x_\max)$. 3) return $x_\max$.

You don't have to store all values. You can start by saying that $x_\max=x_1,\,f_\max=f(x_1)$. Then if $f(x_2)>f_\max$ update the values as $x_\max=x_2,\,f_\max=f(x_2)$. If not, keep the previous values. When all the possible values of $x$ are considered, your $x_\max$ at the end will be the value you are looking for.

Apply this to your situation.