# Expression that expands based on variables

• Apr 15th 2013, 03:39 AM
Zebub
Expression that expands based on variables
I don't know if this is the correct sub-forum for this question. If it isn't, I'm sorry.

I have this expression that expands based on the variables given:

$a(2,2) = (\sum\limits_{i_{1}=0}^{2-1} (2-i_{1}) - 1) + (\sum\limits_{i_{1}=0}^{2-2} (2-i_{1}) - 1)$

$a(3,2) = (\sum\limits_{i_{1}=0}^{3-1} (3-i_{1}) - 1) + (\sum\limits_{i_{1}=0}^{3-2} (3-i_{1}) - 1)$

$a(2,3) = (\sum\limits_{i_{1}=0}^{2-1}\sum\limits_{i_{2}=0}^{2-1} (2-i_{1}) \times (2-i_{2}) - 1) +$
\line
$(\sum\limits_{i_{1}=0}^{2-2}\sum\limits_{i_{2}=0}^{2-1} (2-i_{1}) \times (2-i_{2}) - 1) +$
\line
$(\sum\limits_{i_{1}=0}^{2-2}\sum\limits_{i_{2}=0}^{2-2} (2-i_{1}) \times (2-i_{2}) - 1)$
\line
$a(3,3) = (\sum\limits_{i_{1}=0}^{3-1}\sum\limits_{i_{2}=0}^{3-1} (3-i_{1}) \times (3-i_{2}) - 1) +$
\line
$(\sum\limits_{i_{1}=0}^{3-2}\sum\limits_{i_{2}=0}^{3-1} (3-i_{1}) \times (3-i_{2}) - 1) +$
\line
$(\sum\limits_{i_{1}=0}^{3-2}\sum\limits_{i_{2}=0}^{3-2} (3-i_{1}) \times (3-i_{2}) - 1)$

$a(4,4) = (\sum\limits_{i_{1}=0}^{4-1}\sum\limits_{i_{2}=0}^{4-1}\sum\limits_{i_{3}=0}^{4-1} (4-i_{1}) \times (4-i_{2}) \times (4-i_{3}) - 1) +$
\line
$(\sum\limits_{i_{1}=0}^{4-2}\sum\limits_{i_{2}=0}^{4-1}\sum\limits_{i_{3}=0}^{4-1} (4-i_{1}) \times (4-i_{2}) \times (4-i_{3}) - 1) +$
\line
$(\sum\limits_{i_{1}=0}^{4-2}\sum\limits_{i_{2}=0}^{4-2}\sum\limits_{i_{3}=0}^{4-1} (4-i_{1}) \times (4-i_{2}) \times (4-i_{3}) - 1) +$
\line
$(\sum\limits_{i_{1}=0}^{4-2}\sum\limits_{i_{2}=0}^{4-2}\sum\limits_{i_{3}=0}^{4-2} (4-i_{1}) \times (4-i_{2}) \times (4-i_{3}) - 1)$

What I want to do is generalize this expression, i.e.: $a(x,y)= ?$, but I don't know how to go about this. I think I have to use recursion but I don't see how it should be done.
Any help with this would be appreciated.
• Apr 15th 2013, 04:00 AM
Plato
Re: Expression that expands based on variables
How about stating the whole question, using the exact wording.
• Apr 15th 2013, 04:08 AM
Zebub
Re: Expression that expands based on variables
It is not a math question from a book or a teacher. It's an expression of how many comparisons an agorithm (made by me and another) makes in a worst case scenario. If my question is in any way not clear I will try to explain it better?
• Apr 15th 2013, 04:17 AM
Plato
Re: Expression that expands based on variables
Quote:

Originally Posted by Zebub
It is not a math question from a book or a teacher. It's an expression of how many comparisons an agorithm (made by me and another) makes in a worst case scenario. If my question is in any way not clear I will try to explain it better?

Well it is not clear. At least, I can't see whats is going on there.
Can you describe the process used in the summations?
• Apr 15th 2013, 04:43 AM
Zebub
Re: Expression that expands based on variables
Quote:

Originally Posted by Plato
Well it is not clear. At least, I can't see whats is going on there.
Can you describe the process used in the summations?

The first variable (x) determines the upper bound of the summations and the value of the constant the summations indices are subtracted from.

The second variable (y) determines the number of summations, the number of factors the summations operate on, and the number of overall terms.

The y terms each contain y-1 summations, each summation having a lower bound of 0. The upper bound of the summations depends on the term. In the first term all upper bounds are x-1, in the second term one upper bound is x-2 and the others are x-1, in the third term two upper bounds are x-2 and the others are x-1, and so on.

How many factors the summations operate on is equal to y-1, one factor for each summation. Each factor is x-i, where i is one of the summation indices.

I hope that helps to clear it up.