Showing $\int_{0}^{2022}x^{2}-\lfloor{x}\rfloor\lceil{x}\rceil dx = 674$ It is from the 2022 MIT Integration Bee Question 3 states as follows:
$$\int_{0}^{2022}x^{2}-\lfloor{x}\rfloor\lceil{x}\rceil dx$$
I know that the answer is $674$, but I do not know the process and the steps to derive this solution. Can someone please help?
 A: To keep things simple, let's limit the integration to the interval $(n, n+1)$. where $n \in \mathbb{Z}$.
$$\int_n^{n+1} x^2 - \lfloor x \rfloor \lceil x \rceil dx $$
$$= \int_n^{n+1} x^2 - n (n + 1) dx $$
$$= \left(\frac{1}{3}x^3 - n (n + 1)x\right)\Bigg|_{n}^{n+1} $$
$$= \left(\frac{1}{3}(n+1)^3 - n (n + 1)^2\right) - \left(\frac{1}{3}n^3 - n^2 (n + 1)\right)$$
$$= \frac{1}{3}n^3 + n^2 + n + \frac{1}{3} - n^3 - 2n^2 - n - \frac{1}{3}n^3 + n^3 + n^2 $$
$$= \frac{1}{3} $$
Gee, sure is convenient that all of those $n$'s cancel out and we're left with a constant.
So all we have to do is add up the integral value $\frac{1}{3}$ over $2022$ of these $1$-unit intervals, to get $2022 / 3 = 674.$
A: $$\begin{aligned} \int^{2022}_0 x^2 - \lfloor x \rfloor \lceil x \rceil \mathrm{d} x &= \sum_{i=0}^{2021}\int_{i}^{i+1} x^2 - \lfloor x \rfloor \lceil x \rceil \mathrm{d} x \\ &= \sum_{i=0}^{2021}\int_{i}^{i+1} x^2 - i (i+1) \mathrm{d} x \\ &= \int_{0}^{2022} x^2 \mathrm{d} x -   \sum_{i=0}^{2021}i (i+1).
\end{aligned}$$
From here, one just have to compute the integral on the left, and the sum on the right (see Amos's solution for the numerical computation)! The idea is to note that for $i < x < i + 1$, $\lfloor x \rfloor = i$ and for $i < x < i + 1$, $\lceil x \rceil = i+1$. If you are worried about the contribution at $x = i$ and $x = i+1$, note that the value of an integral does not change if it differs at finitely many points (in which for this case, we are not concerned with how $\lfloor x \rfloor \lceil x \rceil$ behaves at the boundary points $x = i$ and $x = i+1$)
Can we do better?
Note that $x^2$ looks just like $\lfloor x \rfloor \lceil x \rceil$, and looks like the discrete approximation of $x^2$. In fact, this intuition can be made rigorous from the previous computation, in which
$$\begin{aligned} \int^{2022}_0 x^2 - \lfloor x \rfloor \lceil x \rceil \mathrm{d} x &= \sum_{i=0}^{2021}\int_{i}^{i+1} x^2 - i (i+1) \mathrm{d} x \\ &= \sum_{i=0}^{2021} \left( \frac{(i+1)^3}{3} - \frac{i^3}{3} - i(i+1)(i+1-i)\right) \\
&= \sum_{i=0}^{2021} \frac{1}{3} \\
&= \frac{2022}{3} = \boxed{674}. \\
\end{aligned}$$
You don't have to memorize the formula for infinite sums if you do it this way!
A: Separate the integral into two halves: $$\int_0^{2022} x^2 dx - \int_0^{2022}\lfloor x \rfloor \lceil x \rceil  dx = \frac{2022^3}{3} - \int_0^{2022}\lfloor x \rfloor \lceil x \rceil  dx$$
For the second integral, take partition $P={(0,1,2,\cdots,2022)}$ and form lower and upper Darboux sums: $$L(P,f)=U(P,f)=0\cdot 1+1\cdot2+2\cdot3+\ldots+2021\cdot2022=\sum_{x=1}^{2022}x(x-1)$$
which we can compute using formulae for sums of powers of integers if you'd like, or recognizing the summand as $2{x \choose 2}$ we can use the hockey stick identity:
$$\sum_{x = 1}^{2022} 2{x \choose 2} = 2{2023 \choose 3} = \frac{2023 \cdot 2022 \cdot 2021}{3} = \frac{2022^3 - 2022}{3}$$
Subtracting this from our first integral gives
$$\frac{2022^3}{3} - \frac{2022^3 - 2022}{3} = \frac{2022}3 = \boxed{674}$$
