Guidance to solve $\int_{\mathbb{R}} x d\mu(x)$ using two-atom measure Consider the measure $\mu = (1-p)\delta_0 + p\delta_1$ on the Borel sets of $\mathbb{R}$, where $\delta_x(B) = 1$ if $x\in B$ and $0$ otherwise, where $B$ is a Borel set. Using this measure, I'm trying to solve the following integral.
$$
\int_{\mathbb{R}} x d\mu(x).
$$
In class we defined the Lebesgue integral as a limit of the integral of a simple function. Therefore I thought I would construct a staricase-like simple function $f_n$ as is shown in the figure below (where $f = x$), and just take the limit. However, defining $f_n$ in this way requires countably infinite many terms, so it wouldn't be a simple function. And anyways it seems overly complicated to have to take a limit every time I compute an integral. So my question is: Am I on the right path, or is there some easier to solve it? 
 A: Very rarely do we use definitions to actually compute things! We use definitions to prove very basic theorems, and then we use those theorems to prove other more complicated theorems or perform day-to-day computations.
Think about it: if I gave you the function $\phi(t)=e^{\arctan(t^3\cosh(\arctan t^3))}$ and asked you to prove it is differentiable and compute its derivative, would you really start with the limit definition $\lim\limits_{h\to 0}\frac{\phi(t+h)-\phi(t)}{h}$? Heck no! You’d use known theorems about differentiability, such as the (differentiability of, and formulas for) derivatives of polynomials, $\arctan,\exp,\cosh$ etc, the sum rule, product rule, chain rule etc. It’s the same story with integrals. Lebesgue integrals aren’t things to be feared! They may have a slightly more complicated definition than Riemann integrals, but they enjoy so many wonderful theorems, that it’s a joy to compute with.

Let $f(x)=x$. Then, for $p\in [0,1]$, we have
\begin{align}
\int_{\Bbb{R}}f\,d\mu&=(1-p)\int_{\Bbb{R}}f\,d\delta_0+p\int_{\Bbb{R}}f\,d\delta_1\\
&=(1-p)f(0)+pf(1)\\
&=(1-p)\cdot(0)+p\cdot(1)\\
&=p.
\end{align}
The following theorems were invoked:

*

*Suppose $\mu_1,\mu_2$ are positive measures on the same measurable space $(X,\mathfrak{M})$, let $c>0$ and let $f:X\to\Bbb{R}$ be a measurable function. The set function $\mu:=c\mu_1+\mu_2$ is in fact a measure, and $f$ is in $L^1(\mu)$ if and only if it is in $L^1(\mu_1)$ and in $L^1(\mu_2)$. In this case, $\int_Xf\,d\mu=c\int_Xf\,d\mu_1+\int_Xf\,d\mu_2$.

*For any measurable space $(X,\mathfrak{M})$, any point $a\in X$, and any measurable function $f:X\to\Bbb{R}$, we have that $f\in L^1(\delta_a)$, and $\int_Xf\,d\delta_a=f(a)$, where $\delta_a$ denotes the Dirac measure on $X$ centered at $a$.

How do you prove these theorems? Prove them first when $f$ is the indicator of a measurable set. Then, prove it for non-negative simple functions. Then, prove it for all non-negative measurable functions using the monotone-convergence theorem. Finally, prove it for signed functions by considering the positive and negative parts (and you can also consider complex-valued functions by decomposing into real and imaginary parts). This is the standard game.

Anyway, if you want to do things directly, then here you can do things very simply because the measure $\mu$ is concentrated on $\{0,1\}$. So, $f=g$ a.e with respect to $\mu$ if and only if $f(0)=g(0)$ and $f(1)=g(1)$. It doesn’t matter what the functions do outside of this interval. So, consider the simple function $s=\chi_{\{0\}}+\chi_{\{1\}}$. Then, $s(x)=f(x)$ for $\mu$-a.e. $x\in\Bbb{R}$. THis may sound non-intuitive to you because there is an uncountably infinite number of points where $s$ is not equal to $f$, but that doesn’t matter! The measure $\mu$ here only cares about the two points $\{0,1\}$, and since $f=s$ on this two-element set, we’re good to go. So, if you really want to be pedantic, you can set the sequence $f_n=s$ to be the constant sequence. Then, $\int_{\Bbb{R}}f\,d\mu=\lim\limits_{n\to\infty}\int_{\Bbb{R}}f_n\,d\mu=\lim\limits_{n\to\infty}\int_{\Bbb{R}}s\,d\mu$, and $s$ is a simple function, not depending on $n$ so this final limit is easy to calculate by definition of integral of a simple function.
If you want to choose $f_n$ to be a “staircase” as in your original suggestion, you can, for instance, simply truncate it to be $0$ outside $[-n,n]$ (hence you have finitely many pieces, so it really is a simple function), and just make sure that for large enough $n$, you actually have $f_n(0)=0$ and $f_n(1)=1$. These are the two points of interest for this measure!
A: Formally, you let $f_n$ be a sequence of simple function that go to $f$ in the limit, and you compute the integral using
$$
  \int f(x)d\mu(x) = \lim_{n\to\infty}\int f_n(x)d\mu(x) = \lim_{n\to\infty}\sum c_i\mu(B_i).
$$
In practice, this is cumbersome. You would use known properties to simplify the computation, e.g. you known its $\mu$'s Radon Nikodym derivative or you see you integral is a linear combination of other integrals you know the answer to/know how to compute.
In your example you would use that $\delta_y$ has another equivalent definition given by
$$
  \int f(x)d\delta_y(x) = f(y).
$$
This turns your computation into
$$
  \int x d\mu(x) = (1-p)\int x d\delta_0(x)+p\int x d\delta_1(x) = (1-p)(0)+p(1) = p.
$$
