Matrix arithmetic operations
Overview
Sure this is one way to represent a Matrix.
typedef vector&lt;vector&lt;double&gt; &gt; Matrix;

The problem here is that there is no enforcement that these are rectangular. Your code makes the assumption they are rectangles and things will go very wrong if the assumption is wrong.
You don't use encapsulation.
Matrix add(Matrix a, Matrix b)
Matrix subtract(Matrix a, Matrix b)
Matrix multiply(Matrix a, double b)
Matrix multiply(Matrix a, Matrix b)
Matrix dotProduct(Matrix a, Matrix b)

All these are standalone methods. Not an absolute no-no but using classes correctly you can enforce the rectangular size requirements (preferably at compile time) but you could do it at runtime. If you use these methods then these would normally be member functions.
Also these functions are just wrong:
Matrix multiply(Matrix a, Matrix b)
Matrix dotProduct(Matrix a, Matrix b)

Neither of these functions do what they advertise. You should check out wikipedia for the definitions.