Comprehensive conditional probability question Bob owns a bakery. It is located on a busy road with a lots of individuals walking by the bakery each day. On average, $\lambda$ individuals go into the bakery per day, the number of individuals entering the bakery follow a Poisson distribution, $N\sim P(\lambda)$. Each person who enters the bakery has a probability $p$  of demanding a loaf of bread. The quantity of loaves demanded, given the number of customers, $N$, follows a Binomial distribution, $X|N \sim Bin(N;\pi)$. Bob sells loaves at a common price of $p$. At dawn, Bob bakes $k$ loaves at a marginal cost of $c$ per loaf and has overhead costs of $F$ per day. At the end of the day, all loaves not sold are thrown away.
(a) Show that the marginal distribution of the demand for loaves, $X$, is a Poisson distribution, $X\sim P(\theta )$, where $\theta =\pi\lambda$.
I was able to show this. I included this part for completeness, in case one requires it to solve subsequent parts.
(b) Sales, $Y$ , are related to demand, $X$, and the daily supply of loaves, $k$, by the relationship $Y = \text{min{$X,k$}}$.  Derive the p.m.f. for $Y$ .
This implies that sales equal demand if demand is less than the quantity of loaves available, i.e. $Y=X$ when $X\le k-1$ (noting that $k$ is integer valued). But for demand greater than $k$, demand cannot be met, hence sales then equal the total supply of loaves, $k$, i.e. $Y = k$ for $X\ge k$.
I don't know how to use this to find a pmf for $Y$.
(c) Obtain an expression for the profit random variable, $\Pi (Y|\theta,k)$, as a function of sales, $ Y$, when Bob bakes $k$ loaves, $k$ is a non-negative integer. Hence derive an expression for expected profit when Bob bakes k loaves.
I believe having the answer to (b) is necessary for solving this part of the question, and all subsequent parts.
(d) Bob hires you to figure out the number of loaves he should bake at dawn? Provide your answer to Bob's question, indicating what his expected profit will be, and write a short report explaining your answer.
To answer the question, assume that Bob is risk neutral and wishes to choose the quantity of loaves to bake to maximise his expected profit, and that $\lambda= 20;   \pi= 0.7; p=5; c=2 \text{ and } F =10$.
(e) If Bob adopts your solution for the quantity of loaves to bake, $k$, what is the probability that Bob will sell all his loaves on any given day? What is the probability that Bob will suffer a loss on any given day?


This implies that sales equal demand if demand is less than the quantity of loaves available, i.e. $Y=X$ when $X\le k-1$ (noting that $k$ is integer valued). But for demand greater than $k$, demand cannot be met, hence sales then equal the total supply of loaves, $k$, i.e. $Y = k$ for $X\ge k$.
I don't know how to use this to find a pmf for $Y$.

Sure you do.   What you said in words is the piecewise function
$$\mathsf P(Y=y) ~=~\begin{cases}\mathsf P(X=y) & : 0\leq y\leq k-1\\ \mathsf P(X\geq k) & : y=k\\0 & :\textsf{other } y\end{cases}$$
And you know that $~\mathsf P(X=y)~=~\dfrac{\theta^y~\mathsf e^{-\theta}}{y!}~$ and $~\mathsf P(X\geq k)~=~1-\sum\limits_{n=0}^{k-1}\dfrac{\theta^n~\mathsf e^{-\theta}}{n!}$ because $X\sim\mathcal{Pois}(\theta)$

Thusly: $\Pi(Y ; \theta, k) ~=~ \sum\limits_{n=0}^{k-1} n~\mathsf P(X=n) ~+~ k~\mathsf P(X\geq k)$
You can now continue.
