How to derive an equation for a horizontal frictionless harmonic oscillator that has experienced sudden hit by a hammer? Here (and here), I saw an equation for a horizontal frictionless harmonic oscillator (a mass on a spring) that was suddenty hit by a hummer (i.e. the duration of the hit goes to zero). The equation looks like this (neglecting the coefficients):
$$x'' + x = \delta_{\pi}(t)$$
My question is how to derive it.

Some clarification of what I'm specifically interested in.
I know how to derive the left hand side but I want to know how do we end up having Dirac delta on the right hand side.
Normally, we would draw a free body diagram for the mass and write down the second Newton's law in projections on the horizontal axis $x$. Thus, for the moment of the hammer hit we have:

$$ma = F_{spring} - F_{hammer}$$
$$x''-\frac{k}{m} x = - \frac{1}{m} F_{hammer}$$
At this point, we've derived the left hand side. How do we convert the right hand side to a Dirac delta containing function?
As I understand, the second Newton's law that I have written works only for the moment of the hammer hit. That's because $F_{hammer}$ exists only at the moment of the hammer hit - say - at $t=0$.
In other words, $F_{hammer} (t)$ looks like this:

In order to use our equation for all the values on the $t$ axis, we have to "expand" $F_{hammer} (t)$ to the entire $t$ axis. I believe that Dirac delta has something to do with that. I.e. Dirac delta converts our plot to the following one:

I'm very curious about the essence of the mathematical trick that expands the function $F_{hammer}$ which exists only at one point to the entire $t$ axis.
 A: You seem to be new to the concept of the $\delta$-function.
Therefore I will try to motivate this now.
Let's hit the oscillator body with a hammer made of soft rubber.
The force-time graph will look like this:

The force is non-zero for a short time,
while the hammer is in touch with the oscillator body.
The rubber is compressed first, and then bounces back to its original shape.
The momentum transferred from the hammer to the oscillator body can be calculated by
$$\int_{-\infty}^{+\infty} F_\text{hammer}(t)\ dt = P$$
Now let's hit it with a hammer made of hard steel.
Then the force-time graph will look like this:

The situation is similar to the situation above,
except that the hitting time is even shorter,
and the force during this time is even larger.
But the transferred momentum is still the same:
$$\int_{-\infty}^{+\infty} F_\text{hammer}(t)\ dt = P$$
Now let's use an infinitely hard hammer (of course such a thing
doesn't really exist, but let's do it anyway).
The hitting time is zero now, and the hitting force
during this time is infinitely high.
We write the force now using the Dirac delta function as:
$$F_\text{hammer}(t)=P\ \delta(t)$$
Once again the transferred momentum is the same
(now by definition of the $\delta$-function):
$$\int_{-\infty}^{+\infty} F_\text{hammer}(t)\ dt
 = \int_{-\infty}^{+\infty} P\ \delta(t)\ dt
 = P\ \underbrace{\int_{-\infty}^{+\infty}\delta(t)\ dt}_{=1}
 = P$$
The $\delta$-function is just a mathematical idealization
(originally invented by physicists) for modeling infinitely
narrow and high spikes.
A: The only thing I’ll add to Thomas’ great answer is the terminology of an “impulse”, sometimes called “impulse force”.
If you say “And then there is an impulse on the object.”, people will get that it is a very short-term, large force, such as an impact, and we don’t know or care about the specific dynamics of that force, just its net effect, which is an instant transfer of momentum. (Impulse is usually an impact but not always).
That’s because:

*

*It’s of short enough duration that we can assume instantaneous, nothing else in our system will change enough to matter.


*it’s hard to characterize the force/time dynamics, hard to measure or calculate whereas the net result is not hard to determine.
I’d say Impulse is a very high force for a short time characterized not by those force-time dynamics but by the momentum (or equivalently energy) transferred,
(Where technically that net effect is from integrating the force over some short time.)
