Query about implementing Linear Discriminant Analysis

Hi, I am trying to implement LDA on some fMRI data. Trying to do it myself rather that using a package as I'd like to understand whats going on under the bonnet as it were.

I have obtained a weight vector, , according to the formula

where is the (inverse of the) total within-class covariance matrix and denotes the mean of a class (class 2 and 1 in this case)

I can renormalise to counter any numerical issues, since it is the direction and not the magnitude of this vector that is important. So far so good.

I should then be able to find a discriminant , such that a new datum is classified as belong to class 1 if and class 2 otherwise.

I see intuitively that if the prior on each class is the same then (I think)

Is that correct? But more importantly, is there a simple but principled way to establish in the case of asymmetric priors?

Many thanks in advance, MD