This question can be solved easily , if you have some knowledge about resolution of vectors.
all four charges are placed , each at a distance 'a ' from the origin.
it means distance between two charges = √{a² + a² } = √2a
We also know, dipole moment is the system of two equal magnitude but opposite nature charges . so, we have to divide the charges as shown in the figure for making dipoles .
Hence, there are three dipoles formed.
Let P = q(√2a)
then, P₁ = P , P₂ = P and P₃ = 2P {as shown in figure.}
now resolve the vectors P₁ ,P₂ and P₃ .
as shown in figure,
vertical components of P₁ and P₂ is cancelled .
and horizontal components of P₁ and P₂ is cancelled by horizontal component of P₃ .
and rest part of dipole = vertical component of P₃ = 2Psin45° j ['j' shows direction of net dipole moment]
hence, net dipole moment = 2q(√2a) × 1/√2 j
= 2qa j

