Sony xperia z2 how to factory reset i have a sony xperia z2 d6503 running on android 6.0.1
and has two users. ive forgotten the pin for the owner account and using the guest account i created for my kids
now i want to factory reset but havent been successful. please help
I'd assume since you were willing to do a factory reset, that you're also willing to forego all the data currently possessed on your phone.

You could hard reset your device through the following method. 

Procedure


Switch your phone off.
Wait at least 15 seconds before simultaneously pressing the volume down key + power button until the device vibrates.
Through use of you're volume up and down keys, highlight factory reset and hit the power button.



  Ensure that you have enough battery charge to do this(recommended 40% and above; your battery shouldn't also drain fast). Failure to do so could result in soft bricking your phone rendering it useless.


This will reset your phone back to its original state.

Update
The following links provide methods used to hard reset the z2 that I have already outlined in my answer.
Hard reset z2 verizon 
Hard Reset z2 

As has been raised in the comments, that Sony devices do not support hard resetting. The above links provide those methods while I have indeed myself been able to reset sony xperia z4 and the c5. Attached is the method I used to hard reset those devices.