What normalising constant c makes f(x) = c*x a valid density on [0, 2]?
answer
- total area must equal one
- integrate over the support only
- integral of x on [0, 2] is 2
- c times 2 equals 1
- non-negativity fixes the sign
basics
~20 sc = 1/2. The area under c*x from 0 to 2 is c times 2, and a density's total area must equal 1, so c = 1/2. The sign is fixed by requiring the density to be non-negative.
solid answer
~50 sSet the total area to 1. Integrating `c*x` from 0 to 2 gives `c * (2^2 / 2) = 2c`, and the density is zero outside `[0, 2]`, so `2c = 1` and `c = 1/2`. The non-negativity requirement `f(x) >= 0` on the support confirms the positive root rather than a negative one, so the density is `f(x) = x/2` on `[0, 2]` — a triangular shape rising from 0 to a peak of 1 at x = 2. Its CDF follows from integrating again: `F(x) = x^2 / 4` on `[0, 2]`, 0 below and 1 above. From there any probability is a subtraction, for example `P(X > 1.5) = 1 - F(1.5) = 1 - 2.25/4 = 0.4375`. The general pattern is that a normalising constant is whatever makes the area come out to 1 — never whatever makes the peak equal 1.
go deeper
Be ready to state the rule you are applying: a density's total area equals 1. Setting up the integral over [0, 2], getting 2c, and solving 2c = 1 is most of the credit here.
An interviewer expects a clean derivation plus the CDF that follows, F(x) = x^2/4 on the support, and the ability to answer any interval probability by subtraction rather than re-integrating from scratch each time.
Show your checking habits: verify F(0) = 0 and F(2) = 1, cross-check the tail probability by computing the area directly, and note that the median lands above the midpoint because the density rises across the support.
Own the generalisation and the failure mode you would catch in review — a constant fitted so the curve peaks at 1 rather than integrates to 1 silently produces a function that is not a distribution, and every downstream probability inherits the error.
## The two conditions that define a density A function f is a valid probability density function exactly when 1. `f(x) >= 0` for every x, and 2. the total area under f over the whole real line equals 1. Every normalisation problem is condition 2 solved for the unknown constant, with condition 1 used to pick the sign. ## Solving this one The density is `f(x) = c*x` on `[0, 2]` and 0 elsewhere, so only the interval `[0, 2]` contributes area. The area under a straight line through the origin from 0 to 2 is the area of a triangle with base 2 and height `2c`: ``` area = (1/2) * base * height = (1/2) * 2 * (2c) = 2c ``` Or by integration, the integral of `c*x` from 0 to 2 is `c * (2^2 / 2) = 2c`. Either way, ``` 2c = 1 -> c = 1/2 ``` Non-negativity settles the sign: on `[0, 2]` the variable x is non-negative, so `c*x >= 0` requires `c >= 0`, and `c = 1/2` is the answer rather than any negative root. The density is ``` f(x) = x/2 on [0, 2], 0 elsewhere ``` ## Sanity checks worth doing out loud - **Endpoint values.** `f(0) = 0` and `f(2) = 1`. The peak equals 1 here by coincidence of the numbers, not by rule — a density's peak is unconstrained. - **Shape.** A line rising from the origin: mass concentrates towards the right end of the support, so the median should sit above the midpoint 1. - **Area by geometry.** Triangle of base 2 and height 1 has area 1. Consistent. ## Getting the CDF Accumulate the area from the left. For `0 <= x <= 2`, the area under `t/2` from 0 to x is ``` F(x) = x^2 / 4 ``` and `F(x) = 0` for `x < 0`, `F(x) = 1` for `x > 2`. Check the boundaries: `F(0) = 0` and `F(2) = 4/4 = 1`. The CDF is non-decreasing on the support because `x^2` increases there — as it must be. With F in hand every probability question becomes arithmetic: - `P(X > 1.5) = 1 - F(1.5) = 1 - (2.25 / 4) = 1 - 0.5625 = 0.4375` - `P(0.5 < X <= 1.5) = F(1.5) - F(0.5) = 0.5625 - 0.0625 = 0.5` - The median solves `x^2 / 4 = 0.5`, giving `x = sqrt(2)` — about 1.414, above the midpoint, as the shape predicted. You can also get `P(X > 1.5)` directly as the area under `x/2` from 1.5 to 2, which is `(1/4) * (2^2 - 1.5^2) = (1/4) * 1.75 = 0.4375`. Two routes agreeing is a good final check. ## The mistakes this question is built to catch - **Normalising the peak instead of the area.** Setting `f(2) = 1` happens to give `c = 1/2` here, which is a trap: it is the right number for the wrong reason and collapses on any other support. On `[0, 4]` the area rule gives `c = 1/8`, while the peak rule would give `c = 1/4` and produce a function whose total area is 2. - **Forgetting the support.** Integrating `c*x` over the whole line diverges. The density is zero outside `[0, 2]`, and saying so is part of the answer. - **Summing instead of integrating.** Adding up f at a few x values is PMF thinking; a continuous density is integrated. - **Complementing wrongly.** `F(1.5) = 0.5625` is `P(X <= 1.5)`; the question asked for the other side. Reporting 0.5625 for `P(X > 1.5)` is the single most common slip. ## The general pattern For `f(x) = c * x^k` on `[0, b]` with `k > -1`, the area is `c * b^(k+1) / (k+1)`, so ``` c = (k + 1) / b^(k + 1) ``` Check it against this problem: `k = 1`, `b = 2` gives `c = 2 / 4 = 1/2`. Recognising this family means you can normalise any such density in one line rather than re-deriving the integral under pressure. ## How to say it in an interview "Area must be 1. The integral of `c*x` from 0 to 2 is `2c`, so `c = 1/2`, positive because the density cannot be negative. That makes `F(x) = x^2/4` on the support, so `P(X > 1.5) = 1 - 2.25/4 = 0.4375."
- For that density, what is P(X > 1.5)?0.4375. With `f(x) = x/2` on `[0, 2]`, the CDF is `F(x) = x^2 / 4`, so `P(X > 1.5) = 1 - F(1.5) = 1 - 2.25/4 = 1 - 0.5625 = 0.4375`. Computing the tail area directly agrees: `(1/4) * (2^2 - 1.5^2) = 1.75/4 = 0.4375`.
- What is the CDF of this density, and what is its median?`F(x) = 0` for `x < 0`, `F(x) = x^2 / 4` on `[0, 2]`, and 1 above 2 — check `F(2) = 1`. The median solves `x^2 / 4 = 0.5`, so `x = sqrt(2)`, about 1.414. It sits above the midpoint 1 because the density rises, putting more mass on the right of the support.
- Which two conditions make any function a valid density?It must be non-negative everywhere, since no interval may receive negative probability, and its total area over the whole line must equal 1, so that all the probability is accounted for. Nothing else is required — in particular the function need not be bounded by 1, continuous, or monotone.
- How would c change if the same shape were defined on [0, 4] instead?It becomes `c = 1/8`. The area under `c*x` from 0 to 4 is `c * 16/2 = 8c`, so `8c = 1`. The general rule for `c * x^k` on `[0, b]` is `c = (k+1) / b^(k+1)`, which reproduces `1/2` for `k = 1`, `b = 2` and `1/8` for `k = 1`, `b = 4`.
saying these in an interview costs you the question
- Sets the peak of f to 1 instead of the area
- Integrates over the whole line and gets a divergent result
- Sums a handful of f values as if it were discrete
- Accepts a negative constant that makes the area work
- Reports F(1.5) when asked for P(X > 1.5)