calculate phi-hat vector