What is the formula for finding the average atomic mass of an element based on the abundance of its isotopes? In my class my teacher showed us how to find the average atomic mass of an element with a method, but he didn't really state a formula one could use. I came  up with a formula of my own, and from what I observed it works:
$$
\frac{i_1x + i_2y}{100} = A,
$$
where $A$ is the atomic mass, 
$i_1$ is the first isotope's atomic weight, 
$i_2$ is the second isotope's atomic weight, 
$x$ and $y$ are the percentages of the isotopes, respectively,
and they add up to 100, i.e. $x+y = 100$.

Therefore: $$
\frac{i_1x + i_2(100-x)}{100} = A
$$

I'm just wondering, is there an official formula, or is this method it?
The average relative atomic mass of an element comprised of $n$ isotopes with relative atomic masses $A_i$ and relative fractional abundances $p_i$ is given by:

$$
A = p_1 A_1 + p_2 A_2 + \dots + p_n A_n = \sum\limits_{i=1}^n p_i A_i
$$

For example carbon:

\begin{array}{lrrr}
\text{Isotope} &amp; 
\text{Isotopic Mass $A$} &amp; 
\text{Abundance $p$} &amp; 
A\times p\\\hline
\ce{^{12}C}:   &amp; \pu{12.000000 u} &amp; 0.98892 &amp;= \pu{11.867 u}\\
\ce{^{13}C}:   &amp; \pu{13.003354 u} &amp; 0.01108 &amp;= \pu{00.144 u}
\end{array}

Since we have $p_1A_1$ and $p_2A_2$, we add those together to find $A$, therefore 
 the chemical relative atomic mass of carbon is
$$A = \pu{00.144 u} + \pu{11.867 u} = \pu{12.0011 u}.$$