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