Let Mn(R) be the ring of all n × n matrices over a unital ring R, let M be a 2-torsion free unital Mn(R)-bimodule and let D : Mn(R) → M be an additive map. We prove that if D(a)b + aD(b) + D(b)a + bD(a) = 0 whenever a, b ∈ Mn(R) are such that ab = ba = 0, then D(a) = δ(a) + aD(1), where δ : Mn(R) → M is a derivation and D(1) lies in the centre of M. It is also shown that D is a generalized derivation if and only if D(a)b + aD(b) + D(b)a + bD(a) − aD(1)b − bD(1)a = 0 whenever ab=ba=0. We apply this results to provide that any (generalized) Jordan derivation from Mn(R) into a 2-torsion free Mn(R)-bimodule (not necessarily unital) is a (generalized) derivation. Also, we show that if ϕ : Mn(R) → Mn(R) is an additive map satisfying ϕ(ab + ba)=aϕ(b) + ϕ(b)a (a, b ∈ Mn(R)), then ϕ(a) = aϕ(1) for all a ∈ Mn(R), where ϕ(1) lies in the centre of Mn(R), By applying this result we obtain that every Jordan derivation of the trivial extension of Mn(R) by Mn(R) is a derivation.