Question
Question: $g(n) = \int_0^{n^2+n+1} e^{x/2-\lfloor x/2 \rfloor}(\frac{x}{2}-\lfloor\frac{x}{2}\rfloor)d(x-\lflo...
g(n)=∫0n2+n+1ex/2−⌊x/2⌋(2x−⌊2x⌋)d(x−⌊x⌋);n∈N then g(n)
g(n)=n^2+n+2-e^{\frac{1}{2}}.
Solution
We start with
g(n)=∫0n2+n+1ex/2−⌊x/2⌋(2x−⌊x/2⌋)d(x−⌊x⌋),where we note that for any real number x,
2x−⌊x/2⌋={x/2},andx−⌊x⌋={x}.Thus, the integral becomes
g(n)=∫0n2+n+1e{x/2}{x/2}d{x}.Step 1. Partitioning the integral
Since the fractional part {x} resets at every integer, we split the integration interval [0,n2+n+1] into unit intervals. Write x=m+s where m=⌊x⌋ (an integer) and s={x}∈[0,1). On each interval, dx=ds (because away from the jump points, d{x}=ds).
Step 2. Behavior of {x/2} based on parity of m
Write
2x=2m+s=2m+2s.The floor of 2x depends on whether m is even or odd.
-
Case 1: m=2k (even).
2x=k+2s⇒⌊x/2⌋=k,
Then,so that
{x/2}=2s. -
Case 2: m=2k+1 (odd).
2x=k+21+2s⇒⌊x/2⌋=k,
Then,because 21+2s∈[0.5,1) for s∈[0,1). Hence,
{x/2}=21+2s=21+s.
Let Ieven be the integral over one unit interval for even m and Iodd for odd m:
Ieven=∫01e2s(2s)ds,Iodd=∫01e21+s(21+s)ds.Step 3. Calculating Ieven
Write
Ieven=21∫01ses/2ds.Use integration by parts: Let u=s so that du=ds and dv=es/2ds with v=2es/2. Then,
∫ses/2ds=2ses/2−∫2es/2ds=2ses/2−4es/2+C.Evaluating from 0 to 1:
∫01ses/2ds=[2e1/2−4e1/2+4]−[0−4+4]=−2e1/2+4.Thus,
Ieven=21(−2e1/2+4)=2−e1/2.Step 4. Calculating Iodd
We have
Iodd=21∫01e21+s(1+s)ds.Factor out e1/2:
Iodd=2e1/2∫01(1+s)es/2ds.Let
J=∫01(1+s)es/2ds=∫01es/2ds+∫01ses/2ds.First,
∫01es/2ds=2(e1/2−1).We already found ∫01ses/2ds=−2e1/2+4. Thus,
J=2(e1/2−1)+(−2e1/2+4)=2.It follows that
Iodd=2e1/2⋅2=e1/2.Step 5. Summing up over all intervals
The integration variable x goes from 0 to n2+n+1. There are
M=n2+n+1unit intervals and the integration is a sum over these. Since the measure is ds on each unit interval, we only add contributions on each full interval. In the range 0,1,2,…,M−1, the number of even integers is 2M+1 and odd integers is 2M−1 (since M is odd because n(n+1) is even).
Thus,
g(n)=2M+1Ieven+2M−1Iodd,with Ieven=2−e1/2 and Iodd=e1/2. Substitute:
g(n)=2M+1(2−e1/2)+2M−1e1/2.Simplify:
g(n)=21[(M+1)(2−e1/2)+(M−1)e1/2].Expanding,
(M+1)(2−e1/2)=2M+2−Me1/2−e1/2, (M−1)e1/2=Me1/2−e1/2.Adding these:
2M+2−Me1/2−e1/2+Me1/2−e1/2=2M+2−2e1/2.Thus,
g(n)=21[2M+2−2e1/2]=M+1−e1/2.Recalling M=n2+n+1, we obtain:
g(n)=n2+n+1+1−e1/2=n2+n+2−e1/2.