Finding the resultant vector