used matrix calculations to find pVector