Formula for calculating weighting percentages given individual grades and final grade I was wondering what the general formula is for calculating the weight (%) of each category in a gradebook given the individual grade for each category and the final grade. For example, lets say category 1 was a 96%, category 2 was a 93% and category 3 was a 89% and the total was 92.7%, what formula could I use to determine that category 1 and 3 were worth 30% and category 2 was worth 40%. I am looking for a formula that scales up, meaning for n categories given individuals and the final grade the weight of each category can be calculated.
Thanks
 A: This is exactly what you can do by solving a linear system of equations (LSE). In your example you have three unknowns (the three weights). Now in order to solve for those 3 unknowns you need three equations. Meaning you need at least two other set of grades, where a set is made up of one grade for each category and the final grade.
In linear algebra notation it would look like this:
$$\begin{bmatrix}
g_{11} & g_{12} & g_{13}\\
g_{21} & g_{22} & g_{23}\\
g_{31} & g_{32} & g_{33}
\end{bmatrix}\begin{bmatrix}w1\\
w2\\
w3\end{bmatrix} = \begin{bmatrix}g_{1f}\\g_{2f}\\g_{3f}\end{bmatrix}$$
$$Gw=g_f$$
Where $g_{ij}$ is the grade of the $i$th student and in the $j$th category, $w_j$ is the weight of the $j$th category and $g_{if}$ if the final grade of the $i$th student. Assume the matrix of grades $G$ is invertible, you can calculate the weights $w$ by solving the LSE:
$$w = G^{-1}g_f.$$
A: What you are essentially after is a regression. In mathematical terms, you have
$$\sum w_i x_i = S$$
$$\sum w_i = 1$$
With only this much data, you cannot analytically solve this system. There isn't a unique solution for $n > 2$. Since there isn't a way to solve it analytically, you will have to follow an iterative process so that at the end of each step, the weights refine and bring the sum closer and closer to $S$. Which solution you end up on depends on your initial guess for the weights
Let us consider the function
$$f(\bar{w}) = \sum_{i=1}^nw_ix_i - S$$
We take an initial guess as $w^{(0)}_i = \frac{1}{n} \forall i \in \{1,2...,n\}$
Now,$\nabla f = \bar{x}$
Let the next guess be $\bar{w}^{(1)} = \bar{w}^{(0)} - (\bar{x}^T\bar{x})^{-1}\bar{x}^Tf(\bar{w}^{0})$
And keep refining till you get close to within a given error of $S$
