Let $S$ be a set of distinct points in $[a,b]$: $S=${$s_1,...,s_k$}. Define $f:[a,b]\rightarrow \mathbb{R}$ with $f(x)=1$ if $x\notin S$ and $f(x)=0$ if $x\in S$. Prove directly from the definition of the Riemann integral that $f\in \mathcal{R}$ and compute $\int_a^b f \,dx$.
Here is my attempt:
Since $S$ is finite, there exists a point $x\notin S$ in any subinterval of $[a,b]$. So, $M=1$ for any subinterval. Hence, $\overline{\int_a^b} fdx=\text{inf }\sum_{i=1}^n M_i\Delta x_i=b-a$.
Now, it remains to show $\underline{\int_a^b} fdx=b-a$. My idea is as follows:
Consider a set $S$ consisting of only one point $s$: $S=${$s$}. Choose a partition $P=${$x_0,...,x_{i-1},x_i,...,x_n$}, so that $x_{i-1}<s<x_i$ such that $|x_i-x_{i-1}|<\delta$. By letting $\delta\rightarrow 0$, the sum $\sum_{i=1}^n m_i\Delta x_i$ takes its supremum which should be $b-a$. For $S'$ containing $k$ points, we can do the same operation $k$ times, and get $b-a$.
Is my idea legit? And if so, how do I rigorously write this idea down as a part of this proof?
Yes, your idea is good! To write it rigorously, we can break the interval up into smaller intervals, each of which only contains one point of $S.$
First, let's elaborate on your proof when $S = \{s\}.$ For each $\varepsilon > 0$, we can choose a partition $P = \{x_{0}, \ldots, x_{n}\}$ of $[a, b]$ such that the interval of the partition containing $s$ has width $< \varepsilon$. More explicitly:
Now, $m_{i}$ is 1 for each interval of the partition except for the one that contains $s$, where it is zero. Therefore, $$L(P, f) = b -a - (\text{width of interval containing } s) > b - a - \varepsilon.$$
Since $\varepsilon > 0$ was arbitrary, it follows that $\sup L(P, f) \geq b -a.$ Then, since for each partition $P$ $m_{i}$ is at most $1$ (because $f$ is at most $1$), it follows that $L(P, f) \leq b-a$ for all $P$, and so $\sup L(P, f) = b-a.$ $\square$
Now, given $S = \{s_{1}, \ldots, s_{k}\},$ let $x_{1}, \ldots, x_{k}$ be points in $[a, b]$ such that $$a < s_{1} < x_{1} < s_{2} < \cdots < x_{k-1} < s_{k} < x_{k} < b.$$ Then, let $S_{1} = [a, x_{1}],$ $S_{2} = [x_{1}, x_{2}],$ and so on until $S_{k} = [x_{k-1}, x_{k}],$ $S_{k+1} = [x_{k}, b].$
Each $S_{i}$ contains exactly one point of $S,$ so by your argument for $\varepsilon> 0$ and each $S_{i}$ we can find a partition $P_{i}$ such that $$L(P_{i}, f|_{S_{i}}) > \text{width of } S_{i} - \varepsilon.$$
Now, note that a collection $P_{1}, \ldots, P_{k+1}$ of partitions for $S_{1}, \ldots, S_{k+1}$ can be put together to obtain a partition of $S$ (because $S$ is the union of the $S_{i}$, which only overlap at endpoints, hence the partitions all respect one another). Furthermore, if $P$ is the partition of $S$ obtained by putting the $P_{i}$ together, we have $$L(P, f) = \sum_{i=1}^{k+1} L(P_{i}, f|_{S_{i}}).$$ (Check this for yourself!)
So, given $\varepsilon > 0,$ we can choose partitions $P_{1}, \ldots, P_{k+1}$ of $S_{1}, \ldots, S_{k+1}$ such that for each $i$ $$L(P_{i}, f|_{S_{i}}) > \text{width of } S_{i} - \frac{\varepsilon}{k+1},$$ and thus the combined partition $P$ satisfies $$L(P, f) = \sum_{i=1}^{k+1} L(P_{i}, f|_{S_{i}}) > \sum_{i=1}^{k+1} \text{width of } S_{i} - \varepsilon = b-a - \varepsilon.$$
So, it follows that $\sup L(P, f) \geq b-a.$ Then, since for each partition $P$ $m_{i}$ is at most $1$ (because $f$ is at most $1$), it follows that $L(P, f) \leq b-a$ for all $P$, and so $\underline{\int_{a}^{b}} f \mathrm{d}x = \sup L(P, f) = b-a.$ $\square$