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

$\def\unit{{\rm unit}}\def\join{{\rm join}}$It's well known that (discrete) probability distributions form a monad. Specifically, if we let $PX$ be the set of discrete probability distributions on elements of $X$, and notate them as a set of pairs $(x,p)$ such that $\sum p=1$, then we have natural transformations

$$\begin{align} \unit : X & \to PX \\ \unit : x & \mapsto \{ (x,1) \} \\ \\ \join: P(PX) & \to PX \\ \join: D & \mapsto \{(y,pq)| (x,p) \in D, (y,q)\in x \} \end{align}$$

that satisfy the monad laws.

Can probability distributions be made into a comonad as well? For that, we would need to provide natural transformations

$$\begin{align} {\rm counit} : PX & \to X \\ {\rm cojoin} : PX & \to P(PX) \end{align}$$

that satisfy the comonad laws. It seems that the role of counit can be played by mathematical expectation (as long as $X$ is an $\mathbb{R}$-module), but in that case what is the correct definition of cojoin?


Zhen Lin pointed out in the comments that if you want to have counit being expectation, then you need an $\mathbb{R}$-module structure on $PX$ as well as on $X$. The module operations on $PX$ are inherited from those on $X$ in the following way:


$$D_1 + D_2 = \{ (x+y,pq) | (x,p)\in D_1, (y,q)\in D_2\}$$

Multiplication by a scalar

$$qD = \{ (qx,p) | (x,p)\in D \}$$

share|cite|improve this question
Your description of the unit of $P$ monad seems to be incorrect. Do you mean to have $1 / |{X}|$ instead of $1$? In that case, I suppose you must also assume that $X$ is finite. – Zhen Lin Jun 28 '12 at 7:42
No - here $X$ is a set (the sample space), and ${\rm unit}(x)$ is the trivial distribution over $x\in X$, i.e. the distribution which always selects $x$. – Chris Taylor Jun 28 '12 at 7:46
Ah, yes. That makes sense. I don't think can make expectation into the comonad unit, because $P X$ is not a vector space even when $X$ is. – Zhen Lin Jun 28 '12 at 7:49
It's possible to define a vector space structure on $PX$. I'll edit the question to include that. – Chris Taylor Jun 28 '12 at 7:59
Your formula for $D_1 + D_2$ will misbehave when there are $x_1, x_2, y_1, y_2$ such that $x_1 + y_1 = x_2 + y_2$. – Zhen Lin Jun 28 '12 at 9:13

Your Answer


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

Browse other questions tagged or ask your own question.