Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got to optimize the following function with respect to $\phi$:

$q(\phi, x) = \frac{1}{n} \sum_{i=1}^{n}{H(y_i)}$


$y_i = k - \phi l - x_i$

and $H(.)$ denotes the Heaviside function. $k$ and $l$ are constants, and $x$ follows either (1) a continuous uniform distribution or (2) a normal distribution. This is part of a quite standard programming problem but I'm a little stuck with finding the optimal $\phi$

I'm sure this is a totally simple question but I can't quite figure it out... any help is greatly appreciated...

share|cite|improve this question
How does a finite number $n$ of discrete values $x_i$ being drawn from a continuous distribution have anything to do with $q$ being continuously differentiable? $q$ has $n$ jumps, no matter how the $n$ discrete values $x_i$ were produced. – joriki Aug 24 '12 at 19:23
You are right of course about $q$, sorry for this glitch. Do you think there is a way to work around it anyway, maybe something along these lines?… – jush Aug 24 '12 at 20:08
The title and body don't match. I've provided an answer to the question in the body. – joriki Aug 24 '12 at 20:27
up vote 0 down vote accepted

The step functions all add up in the same direction, since $\phi$ has the same sign in all $y_i$ – thus $q$ is minimal for all $\phi$ such that all step functions are $0$, which occurs for $\phi\lessgtr(k-x)/l$, where the inequality is $\lt$ or $\gt$ and $x$ is the greatest or least of the $x_i$, depending on whether $l$ is negative or positive, respectively.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.