How to use the random variable calculator
Prepare the values for this calculation
Calculate expectation, variance, and standard deviation of a discrete random variable. Use the formula below to check that it answers your question. Read the input units before transferring figures from a statement, measurement or dataset.
Enter and check each input
- Possible values: use the same separators and value order as the example in the input table. Replace the example data with your own complete dataset.
- Probabilities: use the same separators and value order as the example in the input table. Replace the example data with your own complete dataset.
The input table gives a complete example. Keep units and time periods consistent across related fields.
Calculate and resolve any input error
Choose Calculate after entering the values. Changes also update the answer after a short pause. If an error appears, follow its message, correct the field and calculate again. Reset restores the example values.
Interpret the answer
Read Expected value and the output limits. This is a sample generated during calculation; a new calculation may produce a different result. The worked example illustrates the output format rather than a value you must reproduce.
Compare and keep a useful result
The result diagram shows the inputs, method and output. A numeric chart is shown only when the calculation supports a meaningful numeric relationship.
Use Copy result or Download CSV to keep the answer. Share tool shares the page address without placing your input values in the URL. Recheck inputs and assumptions before using the result for a decision.
Random Variable Calculator formula
E[X]=Σxᵢpᵢ; Var(X)=Σ(xᵢ−E[X])²pᵢ.
Inputs and units
| Input | Format / range | Example |
|---|---|---|
| Possible values | Text / numeric list | 0,1,2 |
| Probabilities | Text / numeric list | 0.25,0.5,0.25 |
Worked example
Illustrative generated sample. Your output may differ; this value is not a recommended password or a prediction.
Using the example inputs above, the expected value is 1.
- Expected value
- 1
- Variance
- 0.5
- Standard deviation
- 0.707106781187
Results and assumptions
The output uses the expected value convention and formula shown above. Match the entered units and source assumptions when comparing results.
Fix an input or unexpected result
A different generated sample is expected. Password and UUID generation require secure browser randomness; if it is unavailable, use a current browser on HTTPS. Never use a deterministic pseudo-random sequence as a password.
If a discrepancy remains, report the calculator issue with the page address, non-sensitive example inputs, actual result, expected result and a reference for your calculation.
