A simple way to differentiate an equation with respect to x is to reduce each x components power by one and multiply each x component by their original power.
Looking at the equation y = x^2 + 3x + 1, the component x^2 will be reduced from a power of 2 to a power of 1 and multiplied by its original power 2 to give 2x. The component 3x is reduced from a power of 1 to a power of zero and multiplied by its original power of 1 to give 3. As 1 is a constant and not an x component it dissapears in the differentiated eqution.
This therefore gives an answer of dy/dx = 2x + 3.