a phone company orders $b$ iPhones.
Let $Y\sim U[0,100]$ be the number of people interested to buy an iPhone from the company.
The company sells an iPhone for everyone that is interested to buy one.
For every iPhone the company sells, it gets $3\$$ profit, and for every iPhone the company orders and doesn't sell, the company loses $1\$$.
Find for which $b$ the expected value of the profit is maximum.
My Attempt:
Let $X$ be the amount of profit of the company.
So I can say $X=3Y - (b-Y)$. All the sold $Y$ iPhones getting $3\$$ profit each, minus the remaining iPhones the company has ordered. And so:
$E(X)=E(3Y-b+Y)=E(4Y)-E(b)=4*\frac{101}{2}-b$.
And here there's just $b=0$ as maximum, and the answer is $b=75.$
$$\begin{aligned}\mathbb{E}X & =\mathbb{E}\left[X\mid Y>b\right]P\left(Y>b\right)+\mathbb{E}\left[X\mid Y\leq b\right]P\left(Y\leq b\right)\\ & =\mathbb{E}\left[3b\mid Y>b\right]P\left(Y>b\right)+\mathbb{E}\left[4Y-b\mid Y\leq b\right]P\left(Y\leq b\right)\\ & =3bP\left(Y>b\right)+\left(4\mathbb{E}\left[Y\mid Y\leq b\right]-b\right)P\left(Y\leq b\right)\\ & =3bP\left(Y>b\right)+\left(2b-b\right)P\left(Y\leq b\right)\\ & =3bP\left(Y>b\right)+bP\left(Y\leq b\right)\\ & =2bP\left(Y>b\right)+b\\ & =2b\left(1-\frac{b}{100}\right)+b\\ & =\frac{1}{100}\left(300b-2b^{2}\right) \end{aligned} $$
This expression takes a maximum value $112.5$ for $b=75$.
Edit:
As MathLover commented a mistake has been made above.
We do not have $P\left(Y>b\right)=1-\frac{b}{100}$ but $P\left(Y>b\right)=1-P(Y\leq b)=1-\frac{b+1}{101}$
This leads to outcome $\frac{1}{101}\left(301b-2b^{2}\right)$ and a maximum for $b=\frac{301}4=75.25$ at first hand.
Of course $b$ must be an integer and (again) we get $b=75$ as final answer.