probability questions involving pattern classification



Hi Everyone,
I was wondering if any one can help me out with the following
problem(s). I am working on a pattern classification questions and i
was wondering if someone had any input to give me

1)write a procedure to calculate the discriminant function
gi(x) = -1/2(x-µi)tΣi-1(x-µi) ? (d/2)ln2pi ? (1/2)ln|Σi| +
lnP(Wi) for a given normal distribution and prior probablility P(Wi)

2)Write a procedure to calculate the Euclidean distance between two
arbitrary points

3)Write a procedure to calculate the Mahalanobis distance between the
mean µ and an arbitrary point x given the covariance matrix Σ
.