Please reason step by step, and put your final answer within \boxed{}.
Given that the angle between vectors $\mathbf{a}$ and $\mathbf{b}$ is $\theta$, and $a=(3,-1)$, $b-a=(-1,1)$, find the value of $\cos \theta$.
user