# Derivative of Bernoulli random variable with respect to $p$

Question: Let $$B\sim$$ Bernoulli$$(p)$$ be a random variable drawn from a Bernoulli distribution with parameter $$p$$. What is the derivative $$\frac{d}{dp}B\:?$$

Background: I encountered this term while deriving the log-likelihood function of a specific distribution with the objective of finding the maximum likelihood estimate for $$p$$. There are many other terms in the original equation, but I am unsure about the derivative of this one.

What I tried so far: Since the cumulative distribution function is $$F_B(\omega)=\begin{cases}0\quad&\omega < 0\\1-p \quad& 0\le\omega< 1\\1 \quad &\omega \ge 1 \end{cases}$$ I would expect that the derivative is $$\frac{d}{dp}B = \begin{cases}-1 \quad& 0\le\omega< 1\\0 \quad &\text{else}\end{cases}$$ but I am not sure if this is correct because I don't know if I am allowed to simply plug in the CDF. Does this make sense?

• Unless you have an explicit definition of $B$ as a r.v. depending on $p$ you cannot differentiate it w.r.t. $p$. Aug 11, 2022 at 12:06
• @geetha290krm Thank you for your comment. I was not sure if $B$ being drawn from Bernoulli$(p)$ counts as $B$ is a function of $p$. So if $B$ is not a function of $p$ is then its derivative $0$, not defined or not solvable? Aug 11, 2022 at 12:13

If we think of $$B$$ as a function from some sample space $$\Omega$$ to $$\{0,1\}$$, then $$B_p(\omega)$$ is the value of $$B$$ with parameter $$p$$ at sample space point $$\omega$$.
Let's pick $$\Omega = [0,1]$$ and $$B_p(\omega)=1_{>p}(\omega),;\ p \in [0,1]$$ with probability measure being the 1-Lebesgue measure $$\mu_1$$ and the $$\sigma-$$field being $$\mathcal{B}([0,1])$$ so we get the probability space $$S_0:=([0,1],\mathcal{B}([0,1]),\mu_1)$$
With this, we see that $$B_p(\omega)$$ is a step function as a function of $$p$$, where $$B_p(\omega)=1$$ for $$p<\omega$$ and $$0$$ otherwise.
$$\frac{d}{dp}B_p(\omega) = \delta_p(\omega)$$
Where $$\delta_p$$ is the dirac delta function at $$p$$.
• Thank you for your answer. So the derivative of $B$ with respect to $p$ depends on how we define the probability space $S_0$? Aug 12, 2022 at 5:06
• @mto_19 no, I think you can leave it general $\Omega$ but it does depend on how you define $B(\omega)$ as mentioned in the comments. The sample space of random variable is often left unspecified in and we often just work with the case where sample space is the range of the random variable and the probability measure is the distribution of the random variable. I just wanted to make $B_p(x)$ a concrete function for clarity -- I'm not as comfortable with trying to do this in full generality. Aug 12, 2022 at 15:02