# Solving equations with Standard Normal CDF and PDF (Optimization)

How do we go about solving equations of this sort, where we need to find $x$ satisfying the below? Here $K$ and $\xi$ are known constants. Also, $\phi$ and $\mathbf{\Phi}$ are the standard normal PDF and CDF, respectively.

\begin{eqnarray*} \frac{\xi\left(K-x\right)^{2}\phi\left(\xi\left\{ K-x\right\} \right)}{\Phi\left(\xi\left\{ K-x\right\} \right)}+\left(K-x\right)\left[\frac{\phi\left(\xi\left\{ K-x\right\} \right)}{\Phi\left(\xi\left\{ K-x\right\} \right)}\right]^{2} & & =\\ \left\{ K-2x\right\} +\frac{1}{\xi}\frac{\phi\left(\xi\left\{ K-x\right\} \right)}{\Phi\left(\xi\left\{ K-x\right\} \right)}+\frac{\xi Kx\phi\left(\xi x\right)}{\Phi\left(\xi x\right)}+K\left[\frac{\phi\left(\xi x\right)}{\Phi\left(\xi x\right)}\right]^{2} \end{eqnarray*}

This comes up during the minimization of this problem.

\begin{eqnarray*} \underset{\left\{ x\right\} }{\min}\left[K\left\{ \xi x+\frac{\phi\left(\xi x\right)}{\Phi\left(\xi x\right)}\right\} +\left(K-x\right)\left\{ \xi\left(K-x\right)+\frac{\phi\left(\xi\left(K-x\right)\right)}{\Phi\left(\xi\left(K-x\right)\right)}\right\} \right] \end{eqnarray*}

Please note this can be shown to be convex and there is a separate thread on this. Convexity of Function of PDF and CDF of Standard Normal Random Variable

• Maybe the most strait method is to plug in $\xi(K-x)$ .(i.e treat it as a new variable) to pdf and cdf of standard normal and then simplify. Commented Oct 16, 2015 at 11:41
• Please note that this will introduce an extra term in those parts where there is only $\xi$$x$ right now. Commented Oct 16, 2015 at 11:44
• Yes, it more complicated than I had though :( Commented Oct 16, 2015 at 12:13
• Could you give some context---how do this equation arise? It might be simpler to attack the original problem directly? Commented Oct 16, 2015 at 13:03
• @kjetilbhalvorsen This arises as a result of an optimization problem. Let me add it to the original question, if that would be helpful. Please let me know if you need any further details. Commented Oct 18, 2015 at 3:39

Denote by $$\lambda(x)$$ the Inverse Mill's ratio $$\lambda(x) := \frac{\phi(x)}{1 - \Phi(x)} = \frac{\phi(-x)}{\Phi(-x)}.$$

Your objective can be rephrased as

$$\min_{x} K\bigg( \xi x+\lambda(-\xi x) \bigg) +\left(K-x\right)\bigg( \xi\left(K-x\right)+\lambda(-\xi\left(K-x \right))\bigg).$$ I don't see how convexity follows from the question you linked, since that question restricts the domain to $$x \geq 0$$ and focuses on the right term.

But, assuming you've convinced yourself of the convexity, such a function is easy to minimize numerically. The convexity gives you that any stationary point is a global minimizer. Here's how to do the optimization in Python.

from scipy import optimize
from scipy import stats

def inv_mills(x):
return scipy.stats.pdf(-x)/scipy.stats.cdf(-x)

#define your constants K and xi
xi = 1.0; K = 2.0;

result = optimize.minimize_scalar(lambda x: K*(xi*x + inv_mills(-xi*x)) + (K-x)*(xi*(K-x) + inv_mills(-xi*(K-x))))
print(result)


My example has the following result:

    nfev: 14
nit: 10
success: True
x: 1.3308029569427138