I have a simple optimization problem: \begin{equation} \max\limits_{k}\overline{Q}_{k}^{-1}(10^{-3})-k^2\\ s.t. k>0 \end{equation} where $\overline{Q}_{k}(b)$ is the complementary CDF of the chi-square random variable with $k$ degrees of freedom, evaluated at b, and $\overline{Q}_{k}^{-1}(b)$ denotes the inverse function of $\overline{Q}_{k}(b)$.
Let $f(k)=\overline{Q}_{k}^{-1}(10^{-3})-k^2$.
Intuitively, to find the optimal $k$, we need the derivative of $f(k)$ w.r.t. $k$.
However, the CDF of the chi-square random variable involves the Incomplete gamma function. Then, I find it challenging to obtain the derivative of $f(k)$ w.r.t. $k$.
In fact, I even can not write $f(k)$ as a closed-form expression w.r.t. $k$.
I plot the simple function $f(k)$ using matlab, it is shown as:

So, the problem is: can we obtain the closed-form solution of the optimization problem?
I also need to obtain the optimization result when $b\neq 10^{-3}$. So, here I just give a special case of my problem, and I want someone can give me help or suggestions.
Thanks!