In this example we are multiplying two binomials so FOIL method can be used.
$$ \begin{aligned} \left( \color{blue}{ 2d-4}\right) \cdot \left( \color{orangered}{ 4d-1}\right) &= \underbrace{ \color{blue}{2d} \cdot \color{orangered}{4d} }_{\text{FIRST}} + \underbrace{ \color{blue}{2d} \cdot \left( \color{orangered}{-1} \right) }_{\text{OUTER}} + \underbrace{ \left( \color{blue}{-4} \right) \cdot \color{orangered}{4d} }_{\text{INNER}} + \underbrace{ \left( \color{blue}{-4} \right) \cdot \left( \color{orangered}{-1} \right) }_{\text{LAST}} = \\ &= 8d^2 + \left( -2d\right) + \left( -16d\right) + 4 = \\ &= 8d^2 + \left( -2d\right) + \left( -16d\right) + 4 = \\ &= 8d^2-18d+4; \end{aligned} $$