TITLE: Kelly criterion with more than two outcomes
QUESTION [22 upvotes]: 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.

REPLY [5 votes]: 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)