# Average Value of a Function with Linear Constraints

• May 13th 2009, 07:36 AM
egatobas3000
Average Value of a Function with Linear Constraints
Assume:

x1, …, xn where 0<= xi <= 1
a1, …., an are positive real constants.

A = Another Positive real contant

Where,
Sum {i = 1 to n} (xi) = 1 (i)
Sum {i = 1 to n} (ai * xi) = A (ii)
In other words, A is the weighted average of a1 , … ,an where x1, … ,xn is the weighting.

Now, here’s the problem:

Can I find the Average value of a function F(X) where F has the format:

F(X) = b1*x1 + b2*x2 + … + bn*xn
Where b1, …, bn are positive real constants ?

It seems like there should be a solution.
It’s the average value of a relatively simple function over a Solution space.
The Solution space is defined as all the valid combinations of x1, …, xn that satisfy the conditions (I) and (ii) from above, which themselves are not that complex.
I’m thinking the average is the Integral of F(X) / Integral (Identity Function) over the solution space.

You would have to use a Multiple Integral n-times for each xi , But I have no idea how to construct the Bounds of each integral given that there are Two constraints.

It seems like the problem should be quite common.
It resembles blending problems in Linear Programming - The Total Make-up of your mixture has to equal 100% and each of the contributing elements adds a certain quantity for a desired blend (the Ai values.)
Then the F(X) function would be like an Objective Function where the Bi values are cost weights associated with the contibuting elements of the Blend.
(Blending Example: I'm mixing drinks and I require a certain alcohol % for the blend. N ingredients each with a given alcohol percentage "a" and a price "b")

In LP the objective is generally to find the Optimal solution, either maximizing or minimizing the value of F(X) that satisfies the constraints.

In this case I'm looking for the average of F(X) for all valid solutions of x1, ..., xn

I'm surprised that a google-search hasn't provided a solution so far.
("Average value of a linear multivariable function with linear constraints.")

Is this a lot more complicated than I think it is?
• May 22nd 2009, 08:28 AM
Media_Man
$f(x)=\sum_{k=1}^n b_k x_k$

$f_{avg}=\int_0^1\int_0^1...\int_0^1 \sum_{k=1}^n b_k x_k~~ dx_1dx_2...dx_n$

$f_{avg}=\frac{1}{2}\sum_{k=1}^n b_k$
• May 22nd 2009, 12:16 PM
egatobas3000
Thanks Media Man for the reply.

I don't think the posted solution satsifies all the requirements of the problem.

By Taking the integral over each xi-dimensional from 0 to 1 you are including values In the average for the function:

$
f(x)=\sum_{k=1}^n b_k x_k
$

That don't satisfy the Two contraints for the problem.

$
\sum_{k=1}^n x_k = 1
$

And

$
\sum_{k=1}^n a_k x_k = A
$

The proposed solution would be valid only if the Values for X were constrained only to the restriction:

$
0 <= x_k <= 1
$

Which would make the domain of the function from 0 to 1 in each of N x dimensions.

Any advice on revising your solution so that the X values only contribute to the Average if they satisfy the contraints would be much appreciated.
• May 22nd 2009, 01:16 PM
Media_Man
A Thousand Apologies
I misread the problem, I thought your question regarding f(x) was simply a means to an end of a more complicated problem.

Let $\sum_{k=1}^n x_k=1$ and $\sum_{k=1}^n a_kx_k=A$ for some predetermined constants $a_k$ and A, with the restriction that $a_i \neq a_j$ in at least one instance (otherwise these two constraints say the same thing, as A would have to be 1). So, without loss of generality, let $a_1 \neq a_2$ .

After some mild algebra, we arrive at:

$x_2=\frac{A-a_1}{a_2-a_1}+\sum_{k=3}^n\frac{a_1-a_k}{a_2-a_1}x_k$ (1)

$x_1=[\frac{a_1-A}{a_2-a_1}-1]+\sum_{k=3}^n[\frac{a_k-a_1}{a_2-a_1}-1]x_k$ (2)

Define $f(x)=\sum_{k=1}^n b_kx_k=1$ for some constants $b_k$

Substituting (1) and (2) into the definition of f(x), we arrive at $f(x)=c_0+\sum_{k=3}^n c_kx_k$ for

$c_0=b_1[\frac{a_1-A}{a_2-a_1}-1]+b_2\frac{A-a_1}{a_2-a_1}$ (3)

$c_k=b_1[\frac{a_n-a_1}{a_2-a_1}-1]+b_2\frac{a_1-a_n}{a_2-a_1}+b_k$ (4) for all $k\geq 3$

This integral is way too long to write all at once, but you can iterate the following, from a=n down to a=3:

$I_n=c_0+\sum_{k=3}^n c_kx_k$

And $I_{a-1}=\frac{\int_0^{1-\sum_{k=3}^a x_k} I_adx_a}{1-\sum_{k=3}^a x_k}$

I'm not even sure this is solvable for the general case, but try n=3,4,5 and see if a pattern emerges. The brute force approach may simply not work, but perhaps a more clever person will come up with something simpler.