Scroll back to top

    Convolution

    Why Is Convolution Important?

    Imagine you are a doctor and to fight an infection you must give your patients 3 doses of medicine.

    Doses = 3

    At the beginning of the week, you have 1 patient. This number increases throughout the week by 1 patient each day. By Friday, you have 5 patients.

    Number of patients per day = [1 2 3 4 5]

    If you wanted to calculate the total number of doses you administer over the week, you would multiply the doses by the number of patients per day and sum this.

    Total doses = [3 6 9 12 15] = 45

    However, imagine the disease evolves. Now, you have to give each patient 3 doses on the first day, 2 doses on the second day, and 1 dose on the third day.

    Doses = [3 2 1]

    Now, how many total doses are administered each day? Each week? This suddenly became more complicated, but convolution is the key to solving this problem.

    What Is Convolution?

    This is a way to take two functions and apply them to each other. You take the first function and map the second function to it. Simplistically, you are taking both functions and performing a sliding multiplication and sum of them.

    Often, we do not know the output of a system, \( y(t) \), but we do know the input, \( x(t) \), and the impulse response, \( h(t) \). The convolution operation allows us to use \( x(t) \) and \( h(t) \) to solve for \( y(t) \):

    $$ y(t) = x(t) * h(t) $$

    Important: The asterisk (\( * \)) is the symbol used for convolution; it does not mean standard multiplication. In continuous time, this is expressed analytically with an integral:

    $$ y(t)=\int_{-\infty}^\infty x(\tau)h(t-\tau)d\tau $$

    Properties of Convolution

    The commutative property:

    $$ x_{1}(t)*x_{2}(t) = x_{2}(t)*x_{1}(t) $$

    The distributive property:

    $$ x_{1}(t)*[x_{2}(t)+x_{3}(t)] = x_{1}(t)*x_{2}(t)+x_{1}(t)*x_{3}(t) $$

    The associative property:

    $$ x_{1}(t)*[x_{2}(t)*x_{3}(t)] = [x_{1}(t)*x_{2}(t)]*x_{3}(t) $$

    Example Problem

    Example Problem: Medication Dosing via Discrete Convolution #doctor_doses

    Returning to the scenario described earlier:

    • Patients per day: Increases from 1 on Monday to 5 on Friday → \( x = [1, 2, 3, 4, 5] \)
    • Dosing regimen: 3 doses on day 1, 2 doses on day 2, 1 dose on day 3 → \( h = [3, 2, 1] \)

    Determine the total number of doses administered each day and over the entire week using discrete convolution (\( y = x * h \)).

    Step 1: Reverse ("flip") the patient array: \( [5, 4, 3, 2, 1] \).

    Step 2: Slide the dosing array \( [3, 2, 1] \) across the reversed patient array from right to left, multiplying aligned pairs and summing the products for each day:

    Day 1:

                [3 2 1]
    [5 4 3 2 1]
    Product: 3 × 1 = 3 doses

    Day 2:

             [3 2 1]
    [5 4 3 2 1]
    Product: (3 × 2) + (2 × 1) = 8 doses

    Day 3:

          [3 2 1]
    [5 4 3 2 1]
    Product: (3 × 3) + (2 × 2) + (1 × 1) = 14 doses

    Day 4:

       [3 2 1]
    [5 4 3 2 1]
    Product: (3 × 4) + (2 × 3) + (1 × 2) = 20 doses

    Day 5:

    [3 2 1]
    [5 4 3 2 1]
    Product: (3 × 5) + (2 × 4) + (1 × 3) = 26 doses

    Day 6:

    [3 2 1]
       [5 4 3 2 1]
    Product: (3 × 0) + (2 × 5) + (1 × 4) = 14 doses

    Day 7:

    [3 2 1]
          [5 4 3 2 1]
    Product: (3 × 0) + (2 × 0) + (1 × 5) = 5 doses

    Resulting Doses Array:

    $$ y = [3, 8, 14, 20, 26, 14, 5] $$

    Summing all daily doses, the total number of doses administered across all 7 days is 90 doses.