Kelly criterion with more than two outcomes I want to calculate the Kelly bet for an event with more than two possible outcomes. Suppose the following game:
A jar contains $10$ jelly beans. There are $7$ black jelly beans, $2$ blue jelly beans, and $1$ red jelly bean. The player wagers $x$ and grabs a single jelly bean randomly from the bag. The payouts are such:


*

*Black Jelly Bean: no payout (i.e. simply lose wager amount $x$)

*Blue Jelly Bean: net odds received on the wager = $10$

*Red Jelly Bean: net odds received on the wager = $30$


In essence the only way to lose the bet is to grab a black jelly bean (i.e. $q = 0.7$). But the net odds received on the wager is still dependent on whether the player grabs a blue ($b = 10$) or red ($b = 30$) jelly bean.
How would I calculate the Kelly bet for this game?

Is it correct to simply calculate the Kelly bet for each positive outcome and then find the weighted average for the final wager? For example:
$$x_b = \frac{10\times0.2 - 0.8}{10} = 0.12$$
$$x_r = \frac{30\times0.1 - 0.9}{30} = 0.07$$
$$x = \frac{0.12\times0.2 + 0.07\times0.1}{0.2 + 0.1} \approx 0.103$$
So the amount to wager would be 10.3% of the bankroll.
Or should I have instead found the weighted average of the net odds received on the wager and then calculated the Kelly bet based on the winning outcomes as a whole (i.e. $p = 0.1 + 0.2 = 0.3$)? For example:
$$b = \frac{10\times0.2 + 30\times0.1}{0.2 + 0.1} \approx 16.7$$
$$x = \frac{16.7\times0.3 - 0.7}{16.7} \approx 0.258 $$
So the amount to wager would be 25.8% of the bankroll.
 A: David Speyer provided an outstanding response that really helped me out during a project, and I thought as a thank you I would provide the code I generated using his approach.  Included in the code is a method to solve for the correct percentage using Newton's method and it is very fast.  It is coded in MATLAB, and while currently formatted as a script, commenting out the definition of matCurr (which uses the values defined for this question) and uncommenting the function definition will have it operate as a function.  Also commented out at the bottom is the ability to plot the ln(growth) in terms of the percentage wagered, as David also demonstrated above:
% function valPercent = funcKellyCriterionThroughNewton(matCurr)
% Peirano, Daniel
% djpeirano@gmail.com

% This function will get argument matCurr as defined in
% scriptOptimalTourney so that the first column defines b and the second
% column defines p.  Using the equation defined at
% http://math.stackexchange.com/questions/662104/kelly-criterion-with-more-than-two-outcomes
% combined with Newton's approach, an attempt will be made to solve for 0
% which should be the location of the maximum pay out. 

% Checks for sum of percent greater than 1, and if the matrix isn't
% profitable will also be done.


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Debugging
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% clearvars -except matCurr

matCurr = [-1, .7; 10, .2; 30, .1];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Constants
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
valThreshold = 0.000001;
valInitialValue = 0.25;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Normalize the percentage to 1
if sum(matCurr(:,2)) ~= 1
    matCurr(:,2) = matCurr(:,2) / sum(matCurr(:,2));
end

% Check if the matrix is even profitable
if sum(prod(matCurr, 2)) <= 0
    valPercent = 0;
    return
end

valPast = 0;
valNext = valInitialValue;
%[b p]
b = matCurr(:,1);
p = matCurr(:,2);

boolBump = 0;
while abs(valPast-valNext) > valThreshold
    valPast = valNext;


    valNumerator = sum(p.*b./(1+b*valPast));
    valDenominator = sum(-b.^2.*p./(1+b*valPast).^2);

    valNext = valPast - valNumerator/valDenominator;

    if valNext < 0 && ~boolBump     %Only bump it once
        valNext = 0;
        boolBump = 1;
    end
end

valPercent = valNext;

% x=linspace(0,1,1000);
% y=zeros(size(x));
% for i=1:length(x)
%     y(i) = sum(p.*log(1+b.*x(i)));
% end
% 
% plot(x,y)

A: Return to the derivation of the Kelly criterion: Suppose you have $n$ outcomes, which happen with probabilities $p_1$, $p_2$, ..., $p_n$. If outcome $i$ happens, you multiply your bet by $b_i$ (and get back the original bet as well). So for you, $(p_1, p_2, p_3) = (0.7, 0.2, 0.1)$ and $(b_1, b_2, b_3) = (-1, 10, 30)$. 
If you have $M$ dollars and bet $xM$ dollars, then the expected value of the log of your bankroll at the next step is
$$\sum p_i \log((1-x) M + x M + b_i x M) = \sum p_i \log (1+b_i x) + \log M.$$
You want to maximize $\sum p_i \log(1+b_i x)$. (See most discussions of the Kelly criterion for why this is the right thing to maximize, for example, this one.) 
So we want 
$$\frac{d}{dx} \sum p_i \log(1+b_i x) =0$$
or
$$\sum \frac{p_i b_i}{1+b_i x} =0.$$
I don't see a simple formula for the root of this equation, but any computer algebra system will get you a good numeric answer. In your example, we want to maximize
$$f(x) = 0.7 \log(1-x) + 0.2 \log(1+10 x) + 0.1 \log (1+30 x)$$

I get that the optimum occurs at $x=0.248$, with $f(0.248) = 0.263$. In other words, if you bet a little under a quarter of your bankroll, you should expect your bankroll to grow on average by $e^{0.263} = 1.30$ for every bet.
A: If $\sum_{i=1}^{n} p_ib_i$ is sufficiently close to zero, then  a good approximation to the solution $x$ of the equation $\sum_{i=1}^{n}p_ib_i/(1+xb_i)$ is given by the ratio of the expected advantage and the variance of the advantage. That is, $x$ is approximately given by $\sum_{i=1}^{n}p_ib_i$ divided by the difference of $\sum_{i=1}^{n}p_ib_i^2$ and $(\sum_{i=1}^{n}p_ib_i)^2$. However, the condition is not satisfied in this specific example.
