Expectation of a mixed random variable My goal is to derive the expected value of the mixed random variable $\min(T_x,n)= \begin{cases} 
      T_x & \text{for} \ \ T_x \leq n \\
      n & \text{for} \ \ T_x > n
   \end{cases}$
where $n \in \mathbb{R}$ is such that $n > 0$ (i.e. $\min(T_x,n)$ has a density over $(0,n)$ and a probability mass at $n$).
My approach was to derive it using the Law of Total Expectation:
$E[\min(T_x,n)] = E[T_x|T_x \leq n] \cdot P(T_x \leq n) + E[n|T_x > n] \cdot P(T_x > n) = \\ E[T_x|T_x \leq n] \cdot P(T_x \leq n) + n \cdot P(T_x > n)$
$P(T_x \leq n)$ and $P(T_x > n)$ are known (CDF / survival function) but the problem is to derive $E[T_x|T_x \leq n] = \int_0^n[t \cdot f_{T_x|T_x \leq n}(t)]dt$, i.e. to derive $f_{T_x|T_x \leq n}(t)$.
Since $f$ is a probability density function (pdf) we can write $f_{T_x|T_x \leq n}(t)=\frac{f_{T_x,T_x \leq n}(t)}{f_{T_x \leq n}(t)}$ but I have no clue what to do next.
Is this approach correct so far (and the most handy) and if it is, how to continue?
 A: I just encountered the same question in my assignment. I looked for existing formulas online but got none. So I had to derive it by myself. It has been four years since you asked this question. But I hope that my answer can still help some people who are suffering from it.
Based on your description, I assume $T_x$ is also non-negative. But it does not matter much if it is not. The main idea of my answer will not change.
When we find it hard to obtain the pdf, we may go back to the cdf. Let's derive $F_{T_x|T_x \leq n}(t)$ first.
\begin{align*}
F_{T_x|T_x \leq n}(t) &= \textbf{Pr}(T_x \leq t |T_x \leq n)\\
&= \frac{\textbf{Pr}(\{T_x \leq t\} \cap \{T_x \leq n\})}{\textbf{Pr}(T_x \leq n)}\\
&= 
\begin{cases}
\frac{\textbf{Pr}(T_x \leq t)}{\textbf{Pr}(T_x \leq n)}, & \text{if } n > t\\
1, & \text{if } n \leq t
\end{cases}\\
&= \begin{cases}
\frac{F_{T_x}(t)}{F_{T_x}(n)}, & \text{if } n > t\\
1, & \text{if } n \leq t
\end{cases}\\
\end{align*}
Now we can take the derivative of the cdf to get the pdf. Some people may doubt its differentiability at $t = n$. But we can prove that the derivative exists by the definition.Then we have the pdf.
\begin{equation*}
f_{T_x|T_x \leq n}(t) = \begin{cases}
\frac{f_{T_x}(t)}{F_{T_x}(n)}, & \text{if } n > t\\
0, & \text{if } n \leq t
\end{cases}
\end{equation*}
Finally, we have
\begin{align*}
\mathbb{E}[T_x|T_x \leq n] &= \int_{0}^{n} t\frac{f_{T_x}(t)}{F_{T_x}(n)} \, dt\\
&= \frac{1}{F_{T_x}(n)}\int_{0}^{n} tf_{T_x}(t) \, dt
\end{align*}
It's so late at night that I don't even want to check whether there are typos. But I believe I have presented all key ideas. The comment left by @Math1000 is also a nice  way to solve your question, where you don't need to find the pdf of $T_x|T_x \leq n$.
