# Expectation of absolute value of a function

Let x be real valued random variable taking values on $a_1,\ldots, a_n$. Let $\Pr(x=a_i)=p_i$. Let $f$ be real valued function defined on $a_1, \ldots, a_n$

It is known that $$E(f(x))=\sum_{i=1}^nf(a_i)p_i.$$

Would be the same formula true for $E(|f(x)|)$, i. e. $$E(|f(x)|)=\sum_{i=1}^n|f(a_i)|p_i?$$

Thank you.

-
Yes. As $|f|$ is "a real valued function, defined on ..." .. just apply your formula to $|f|$. –  martini Jul 10 '12 at 20:24

Let $g(x) := |f(x)|$ be defined on $a_1, \dots, a_n$. The composition of two real valued functions is a real valued function.
Now computing $E(g(x))$...
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9945624470710754, "perplexity": 244.88141652461246}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-41/segments/1410657136966.6/warc/CC-MAIN-20140914011216-00323-ip-10-234-18-248.ec2.internal.warc.gz"}