What is an elegant way of calculating this result (programmatically) in mathematica?
Let $X$ be a random variable with PDF
$$f_{X}(x) = \begin{cases} x/4, & \text{if $1<x\leq3$} \\ 0, & \text{otherwise} \end{cases}$$
Let $A$ be the event $\{X\geq2\}$
Find $f_{X|A}(x)$
Here is the answer done manually for convenience:
$$f_{X|A}(x) = \begin{cases} \frac{f_{X}(x)}{P(A)}, & \text{if $2\leq x\leq3$} \\ 0, & \text{otherwise} \end{cases}$$
$$P(A)=P(X\geq2)=\int_{2}^{3}{f_{X}(x) dx}=5/8$$
$$\implies f_{X|A}(x) = \begin{cases} \frac{2x}{5}, & \text{if $2\leq x\leq3$} \\ 0, & \text{otherwise} \end{cases}$$
I am looking for a programmatic solution that utilizes \[Conditioned]
or something else as high-level.
TransformedDistribution
and ProbabilityDistribution
look like promising avenues, but I am unable to state my problem in terms of them.
I know I could write out the problem explicitly in low level code. But I am looking for an implicit, declarative implementation. Surely mathematica with all its high level abstraction power can do this?
here is a failed attempt
A = X >= 2;
conditionalDist = TransformedDistribution[X \[Conditioned] A, X \[Distributed]ProbabilityDistribution[x/4, {x, 1, 3}] ] ;
PDF[conditionalDist, y]