# Problem Statement

A particle $$\mathcal{P}$$ is initially 1 unit away from $$\mathcal{X}$$ its destination. On its path to $$\mathcal{X}$$, $$\mathcal{P}$$ has a velocity of $$d + 1$$ units per second, where $$d$$ is its distance to $$\mathcal{X}$$. How long will it take for $$\mathcal{P}$$ to reach $$\mathcal{X}$$?

# Solution

First, we will partition the interval of length $$1$$ into $$n$$ equally sized interval. We will assume that $$\mathcal{P}$$ changes its velocity at the endpoints. Then, we may take the limit of our result as $$n \xrightarrow{} \infty$$. This will allow us to simplify the problem.

Let $$d_{i}$$ be the distance traveled by $$\mathcal{P}$$ during the $$i$$th interval, $$v_{i}$$ be its velocity at the beginning of this interval, and $$t_{i}$$ be the amount of time it spends in the interval. Additionally, let $$T_{n} = t_1 + t_2 + t_3 + \cdots + t_n$$ be the total amount of time that it takes $$\mathcal{P}$$ to reach $$\mathcal{X}$$ in a configuration with $$n$$ subintervals. As we add more subintervals, the velocity will become closer to changing continuously. Hence, the total amount of time $$\mathcal{P}$$ takes is $$T = \displaystyle\lim_{n\xrightarrow{} \infty} T_n$$.

Now, we must compute $$T_n$$ in terms of $$n$$. First, we have $$T_n = \displaystyle\sum_{k = 1}^{n} t_k$$. From $$d=rt$$, we may conclude that $$t_k = \frac{d_k}{v_k}$$. Additionally, $$d_k = \frac{1}{n}$$ for all $$k$$ and $$v_k = 2-\frac{k-1}{n}$$ since at the $$k$$th interval it has travelled $$k-1$$ subintervals of length $$\frac{1}{n}$$. Hence, $t_k = \frac{\frac{1}{n}}{2-\frac{k-1}{n}} = \frac{1}{2n-k+1} \Rightarrow T_n = \sum_{k = 1}^{n} \frac{1}{2n-k+1} = \frac{1}{2n} + \frac{1}{2n-1} + \frac{1}{2n-2} + \cdots + \frac{1}{n + 2} + \frac{1}{n+1}.$ We may further rewrite this as

\begin{aligned} \frac{1}{2n} + \cdots + \frac{1}{n+1} &= \left ( \frac{1}{2n} + \frac{1}{2n-1} + \cdots + \frac{1}{2} + \frac{1}{1} \right) - \left ( \frac{1}{n} + \frac{1}{n-1} + \cdots + \frac{1}{2} + \frac{1}{1}\right) \\ &= \left [ \left (\frac{1}{2n} + \frac{1}{2n-1}\right) + \left (\frac{1}{2n-2} + \frac{1}{2n-3}\right) +\cdots + \left (\frac{1}{2} + \frac{1}{1}\right)\right] - \sum_{i = 1}^{n} \frac{1}{i} \\ &= \sum_{i = 1}^{n} \left (\frac{1}{2i} + \frac{1}{2i-1}\right)- \sum_{i = 1}^{n} \frac{1}{i} \\ &= \sum_{i = 1}^{n} \left (\frac{1}{2i} + \frac{1}{2i-1} - \frac{1}{i}\right) \\ &= \sum_{i = 1}^{n} \left (\frac{1}{2i-1} - \frac{1}{2i}\right) \\ &= \left (\frac{1}{1} - \frac{1}{2} \right) + \left (\frac{1}{3} - \frac{1}{4} \right) + \cdots + \left (\frac{1}{2n-3} - \frac{1}{2n-2} \right) + \left (\frac{1}{2n-1} - \frac{1}{2n} \right) \\ &= 1-\frac{1}{2} + \frac{1}{3} - \cdots - \frac{1}{2n-2} + \frac{1}{2n-1} - \frac{1}{2n}. \end{aligned}

Hence, $$T = \displaystyle\lim_{n\xrightarrow{} \infty} T_n = 1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \frac{1}{5} + \cdots$$. However, this is not a closed form. To find the closed form, we turn to calculus.

Let the total distance $$\mathcal{P}$$ has traveled at time $$t$$ be $$x(t)$$ and its velocity be $$v(t)$$. By the problem statement, $$v(t) = (1 - x(t)) + 1 = 2 - x(t)$$. Since $$x(t)$$ is $$\mathcal{P}$$’s position and the rate of change of position is velocity, we have $$v(t) = x'(t)$$. Now, we can simply solve for $$x(t)$$, the position function, by solving the differential equation $$\frac{dx}{dt} = 2 - x$$. However, we will take a different approach.

Differentiating both sides of $$v(t) = 2-x(t)$$ with respect to $$t$$, we get $$a(t) = -v(t)$$, where $$a(t)$$ is the acceleration of $$\mathcal{P}$$ at time $$t$$. Additionally, we have that $$a(t) = v'(t)$$. Plugging this back into $$a(t) = -v(t)$$, we have $$v'(t) = -v(t)$$. Now, we have the differential equation $$\frac{dv}{dt} = -v$$. Separating the variables and integrating both sides, we have

\begin{aligned} \int \frac{dv}{v} &= -\int dt \\ \Rightarrow \ln |v| = \ln v (t) &= -t + C\\ \Rightarrow v(t) = e^{-t+C} &= Ae^{-t}\end{aligned}

for some $$A \in \mathbb{R} ^{+}$$. Note that we can remove the absolute values since $$v(t) \ge 1 > 0$$. We can solve for $$A$$ by plugging in $$t = 0$$. Since at time $$t = 0$$, $$\mathcal{P}$$ is 1 unit away from $$\mathcal{X}$$, its velocity is $$2$$ units per second: $$v(0) = A = 2$$. Hence, $$v(t) = 2e^{-t}$$. Let $$\mathcal{P}$$ reach $$\mathcal{X}$$ after $$k$$ seconds. We know that $$v(k) = 2e^{-k} = 1$$. Hence, we can solve for $$k$$: $2e^{-k} = 1 \Rightarrow e^{-k} = \frac{1}{2} \Rightarrow -k = \ln \frac{1}{2} \Rightarrow k=\ln 2.$ Hence, $$\mathcal{P}$$ will reach $$\mathcal{X}$$ in $$\ln 2$$ seconds.

Since, our answers to the problems must be the same, we have $1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \frac{1}{5} + \cdots = \ln 2$

# Generalization

Now, instead of $$\mathcal{P}$$ starting $$1$$ unit away from $$\mathcal{X}$$, let it be $$d$$ units away.

From the problem statement we have $$v(t) = (d-x(t)) + 1 = d+1-x(t)$$, Taking derivative with respect to $$t$$, we have $$a(t) = -v(t)$$. This is the exact same equation we solved earlier. We found that $$v(t) = Ae^{-t}$$ for some $$A \in \mathbb{R}$$. We can analyze what happens at $$t = 0$$: $$x(0) = d \Rightarrow v(0) = A = d+1$$. Hence, $$v(t) = (d+1)e^{-t}$$. Solving the equation $$v(t) = 1$$, we have $$t = \ln(d+1)$$. Hence, $$\mathcal{P}$$ will reach $$\mathcal{X}$$ in $$\ln(d+1)$$ seconds. Plugging in $$d = 1$$ from the initial problem agrees with our previous result.