You know that when you finish the Euclidian algorithm, you'll get the gcd of 41 and 31 as a remainder, namely 1.
Start from the greatest integer :
41=31+10 ----> 10=41-31
In each step, write what the remainder is. Then continue the Euclidian algorithm :
Write the remainder :
But you know what 10 is. So substitute it in 1 :
1=31-3x(41-31) = 31-3x41+3x31=4x31-3x41
What's the point of all of this ? It's that you can express any remainder in terms of 41 and 31.
So from 1=4x31-3x41, you have u and v.