There are many equations for this! Perhaps the simplest of them is the spreading function for one sample,
y[n] = x[n] - x[n-1]
or by taking its z-transform
H(z) = 1 - z^-1
Where H(z) = Y(z) / X(z) is the system equation for the filter.
Using AudioLazy with MatPlotLib (Python), you can see the frequency response graph for this high-pass filter by typing. ( Disclosure: I am the author of AudioLazy )
from audiolazy import z (1 - z ** -1).plot().show()

You can apply it to the signal as well
from audiolazy import z, Stream filt = 1 - z ** -1 sig = Stream(1, 3, 1, -1, -3, -1)
Result in the first 7 samples:
[1.0, 2, -2, -2, -2, 2, 2]
The same can be done in GNU Octave (or MatLab):
filter([1, -1], [1], [1, 3, 1, -1, -3, -1, 1])
What returns
[1, 2, -2, -2, -2, 2, 2]
In this example, an FIR filter is used in a 6-sample periodic signal, which varies from the amplitude range [-3;3] to [-2;2] . If you try a 12-waveform (lower frequency):
filt = 1 - z ** -1 sig = Stream(1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, 0) filt(sig).take(13)
Now the result will be another square wave, but in the range [-1;1] . You should try the same with sine waves that make sense for the frequency response and should contain a different sine wave as the filter output with the same frequency.
You can also use a Nyquist frequency resonator by providing you with an IIR filter. There are several other filters that can do this (for example, Butterworth, Chebyshev, Elliptical) for different needs. Minimum phase, linear phase, filter stability, and minimizing ripple amplitudes are some of the possible design goals (or limitations) that can arise when designing a filter.