IF THREE-DIMENSIONAL algebra is your strong suit, perhaps you can help the state of Maryland find the perfect formula to comply with Tuesday's complex court decision ordering equal per-pupil spending -- for richer, for poorer -- throughout the state. Here's one clue for starters: do not try to divide the amount of state money available by the number of students in the state; that's too easy, and even Baltimore Circuit Court Judge David Ross -- whose ruling has now sent state and local experts back to their blackboards for another look at the numbers -- isn't seeking that simplistic a response.

What the judge is ordering -- and you can count on an appeal before anything drastic or even different takes place -- is not unlike what courts in more than a dozen states have been calling for over the last decade: a formula ensuring that all local systems in the state have a virtually equal amount of money to spend on each pupil. But the net results in these states have differed, and so, no doubt, will the responses from around Maryland.

One difficulty is in taking into account the different costs of doing educational business around any state. Because property taxes have been the main sources of local financing for the school systems, some districts have more money than others to spend on education. In the Maryland case, the plaintiffs argued -- and the court agreed -- that the current distributions system violates the state constitution's requirements of equal protection as well as of a "thorough and efficient system of free public schools."

There is no question that disturbing fiscal disparities do exist, but the dollar differences may seem more unfair than they are. They do not reflect costs of living in different areas of the state. It costs more to attract and keep teachers, administrators, custodians and other school employees in Montgomery or Prince George's than in the counties on the Eastern Shore. Also, as any parent or pupil surely knows, there is no automatic correlation between the salary and talent of a teacher. In the case of Baltimore City, which also has a relatively lower tax base, there may be other factors and programs that need taking into account by the state, such as early-childhood assistance.

In any event, there is no immediate cause for alarm in Montgomery, Prince George's or other so-called "richer" counties. Litigation and legislation will take time. Besides, there is an important qualifier in the latest decision. The secret word is "unless" -- because Judge Ross in effect has said there can be no deviations from "mathematical equality" unless there is a "clearly demonstrated difference in cost" in a locality. This distinction should not be lost whenever the state does come to grips with this important issue. Adjustments in the state formula are needed. Still, they come best from the courts, but from legislature and the governor. And regardless of what a court may say, they do not come without reasonable political and fiscal accommodation.