{5}{1}\binom{13}{4}$$
solutions that violate the restrictions.
Hence, there are 
$$\binom{24}{4} - \binom{5}{1}\binom{13}{4}$$
admissible solutions, so your second attempt was right.

How many nonnegative integer solutions are there to the equation $$x_1 + x_2 + x_3 + x_4 + x_5 = 20$$ if $x_i \leq 8$ for $1 \leq i \leq 5$?

In this case, at most two of the variables could exceed the restrictions since $2 \cdot 9 = 18 < 20 < 27 = 3 \cdot 9$.
Choose which of the five variables exceeds the restriction.  Since the equation is symmetric with respect to the variables, we may suppose it is $x_1$.  Let $x_1' = x_1 - 9$.  Then $x_1'$ is a nonnegative integer.  Substituting $x_1' + 9$ for $x_1$ in  equation 1 and simplifying yields
$$x_1' + x_2 + x_3 + x_4 + x_5 = 11 \tag{3}$$
Equation 3 is an equation in the nonnegative integers with 
$$\binom{11 + 5 - 1}{5 - 1} = \binom{15}{4}$$
solutions.  Hence, there are 
$$\binom{5}{1}\binom{15}{4}$$
cases in which one of the variables violates a restriction.
However, if we subtract this from the total, we will have subtracted too much since we have counted each case in which two of the variables violate a restriction twice, once for each way we could have designated one of the variables as the one that violates a restriction.  Therefore, we need to add these cases back.
There are $\binom{5}{2}$ ways to select which two of the five variables violates a restriction.  Since the equation is symmetric with respect to the variables, we may suppose they are $x_1$ and $x_2$.  Let $x_1' = x_1 - 9$ and $x_2' = x_2 - 9$.  Substituting $x_1' + 9$ for $x_1$ and $x_2' + 9$ for $x_2$ in equation 1 and simplifying
{ 5}{1}\binom{13}{4}$$ 
 solutions that violate the restrictions. 
 Hence, there be 
 $ $ \binom{24}{4 } - \binom{5}{1}\binom{13}{4}$$ 
 admissible solution, so your second attempt was right. 

 How many nonnegative integer solution are there to the equation $ $ x_1 + x_2 + x_3 + x_4 + x_5 = 20$$ if $ x_i \leq 8 $ for $ 1 \leq i \leq 5 $? 

 In this case, at about two of the variables could exceed the restrictions since $ 2 \cdot 9 = 18 < 20 < 27 = 3 \cdot 9$. 
 Choose which of the five variable exceeds the restriction.   Since the equality is symmetric with respect to the variables, we may suppose it is $ x_1$.   lease $ x_1' = x_1 - 9$.   Then $ x_1'$ is a nonnegative integer.   Substituting $ x_1' + 9 $ for $ x_1 $ in   equation 1 and simplifying yields 
 $ $ x_1' + x_2 + x_3 + x_4 + x_5 = 11 \tag{3}$$ 
 Equation 3 is an equation in the nonnegative integer with 
 $ $ \binom{11 + 5 - 1}{5 - 1 } = \binom{15}{4}$$ 
 solutions.   Hence, there are 
 $ $ \binom{5}{1}\binom{15}{4}$$ 
 event in which one of the variables violates a limitation. 
 However, if we subtract this from the total, we will have subtract too a lot since we have counted each case in which two of the variables violate a limitation twice, once for each way we could have designated one of the variables as the one that violates a restriction.   Therefore, we need to add these cases back. 
 There are $ \binom{5}{2}$ ways to select which two of the five variables violates a restriction.   Since the equation is symmetrical with esteem to the variables, we may presuppose they are $ x_1 $ and $ x_2$.   lease $ x_1' = x_1 - 9 $ and $ x_2' = x_2 - 9$.   Substituting $ x_1' + 9 $ for $ x_1 $ and $ x_2' + 9 $ for $ x_2 $ in equation 1 and simplifying
{5}{1}\binlm{13}{4}$$
solutions that violate the restrictiouw.
Hence, there are 
$$\binum{24}{4} - \binom{5}{1}\binom{13}{4}$$
admissible solntiobs, so your second attempt wxs right.

Hlw many bonntgative integer solutions are tgcre tm the equation $$w_1 + x_2 + x_3 + x_4 + x_5 = 20$$ if $x_i \leq 8$ wox $1 \leq i \leq 5$?

In this case, at most twj of thr gariables coulq exbeqd tgv vestrictions since $2 \cdot 9 = 18 < 20 < 27 = 3 \cdot 9$.
Bhoose which of tne five variables exceeds hhe gestriction.  Since the equatiin if symmetric wkth respecu co the varizbles, we may suppose it is $x_1$.  Ldt $x_1' = x_1 - 9$.  Then $x_1'$ is d nonnegatite intvger.  Substitmning $x_1' + 9$ for $x_1$ in  equation 1 anv sinplifying yields
$$x_1' + x_2 + x_3 + x_4 + x_5 = 11 \tag{3}$$
Equajion 3 is at zquation in the nonnetarive hntecers qitf 
$$\bjnpm{11 + 5 - 1}{5 - 1} = \bmnom{15}{4}$$
solutiohs.  Hence, tyere are 
$$\binom{5}{1}\binom{15}{4}$$
vafvx in which ohe of ehq variables violates a restriction.
Howevtr, if we subtract this from rhe total, we will havg subtractqd too much since we have counted each case in whhch txo of tme vxeiwbles violate a restriction twice, once for easg eaj we could have dcsignated one of tne vstiables as the one tkzt violates a restriftion.  Jherefire, we netd to add these cases back.
There qre $\binom{5}{2}$ wajs ti select which two of the fivz varisbles violates a restriction.  Sihce the equwtion is ahmmetric with rerpebt tm the variables, we may sup[ose they are $x_1$ and $b_2$.  Lgt $x_1' = x_1 - 9$ and $x_2' = d_2 - 9$.  Substituting $x_1' + 9$ fog $x_1$ aud $x_2' + 9$ for $x_2$ in equation 1 and simplifying
{5}{1}\binom{13}{4}$$ solutions that violate the restrictions. Hence, $$\binom{24}{4} \binom{5}{1}\binom{13}{4}$$ admissible so your second nonnegative solutions are there the equation $$x_1 x_2 + x_3 + x_4 + = 20$$ if $x_i \leq 8$ for $1 \leq i \leq 5$? In case, at most two of the variables could exceed the restrictions since $2 9 18 20 27 = 3 \cdot 9$. Choose which of the five variables exceeds the restriction. Since the is symmetric with respect to the variables, we suppose it is $x_1$. $x_1' = x_1 - 9$. $x_1'$ a nonnegative Substituting + for $x_1$ in 1 and simplifying yields $$x_1' + x_2 + x_3 + x_4 + x_5 = 11 \tag{3}$$ Equation is an the nonnegative with + - 1}{5 - \binom{15}{4}$$ solutions. Hence, there are $$\binom{5}{1}\binom{15}{4}$$ one of the variables violates a restriction. However, we subtract from the total, we will have too much since we have counted each case which two of the variables violate a restriction twice, once for each way we could one of the variables the one that a Therefore, need add these back. There are $\binom{5}{2}$ ways to select which two of the variables violates a restriction. Since the equation is symmetric with the we may suppose are $x_1$ and $x_2$. $x_1' x_1 - 9$ and x_2 9$. 9$ $x_1$ $x_2' + 9$ for in equation 1 and simplifying
{5}{1}\binom{13}{4}$$
solutions that violate The restricTions.
henCe, tHeRe arE 
$$\binOm{24}{4} - \binom{5}{1}\binom{13}{4}$$
adMIssiBle solutions, so your secoNd attEmPT was RIgHt.

How Many nonNEgATIve InTeGer SoLUtIons aRe tHere to tHe equation $$X_1 + x_2 + x_3 + X_4 + x_5 = 20$$ If $x_i \leq 8$ for $1 \leQ I \lEq 5$?

In this caSe, aT most two of thE vaRiableS cOulD ExceeD thE restRictioNS since $2 \Cdot 9 = 18 < 20 < 27 = 3 \cdot 9$.
CHoOSe whicH Of the fiVE VaRiabLes exceeds the restRIcTIon.  Since the equAtion iS sYMmETRic WitH respect to ThE variABles, we mAY sUPPOse IT is $x_1$.  Let $x_1' = x_1 - 9$.  Then $X_1'$ is a nonnegaTIve IntegeR.  SUbsTItutinG $x_1' + 9$ for $X_1$ iN  EquAtion 1 and simPlifYing yieldS
$$x_1' + x_2 + x_3 + x_4 + x_5 = 11 \TAg{3}$$
EquatIOn 3 is an eQuatioN in The NonnEGaTiVe iNtEGerS WiTh 
$$\bINom{11 + 5 - 1}{5 - 1} = \Binom{15}{4}$$
solUtIoNs.  HenCe, thERE ARe 
$$\biNom{5}{1}\BinoM{15}{4}$$
caseS in which one of The VariABleS violAtes a RestRiCtion.
howeveR, if we SuBtract this from tHe toTal, we will HavE sUbtRaCted tOO much sIncE we Have couNted eacH CasE iN WHIcH two of the variables ViOLAtE a restriCtion tWIcE, oNCe for eacH wAy wE couLD Have dEsigNAtEd one of tHe variABlEs As the onE tHat vioLaTes A reStricTIon.  THerefoRe, we need To add THese cases back.
THEre are $\binom{5}{2}$ waYS tO SElECt whIch Two of the fivE varIAbleS vioLAtEs a REstriCtion.  siNCe THe equation is symmetrIc With reSpect To the variableS, we may suppOSE They are $x_1$ And $x_2$.  lEt $X_1' = X_1 - 9$ and $x_2' = x_2 - 9$.  SubstituTing $x_1' + 9$ For $x_1$ and $x_2' + 9$ foR $X_2$ in equatIon 1 anD simplifYing
{5}{1}\binom{13}{4}$$
solu tions that  viol ate  th erest rict ions.
Hence, t h ereare 
$$\binom{24}{4} -  \bin om { 5}{1 } \b inom{ 13}{4}$ $ 
a d m iss ib le  so lu t io ns, s o y our sec ond attemp t w as  right.

How ma ny nonnega tiv e integer so lut ions a re  th e re to  th e equ ation$ $x_1 +  x_2 + x_ 3+  x_4 + x_5 = 2 0 $ $if $ x_i \leq 8$ for $ 1  \ l eq i \leq 5$?
In th is ca s e , a t m ost two of  t he va r iablesc ou l d exc e ed the restri ctions sinc e  $2  \cdot  9  =1 8 < 20  < 27  = 3 \ cdot 9$.
Ch oose  which of  the f i ve vari a bles ex ceedsthe  re stri c ti on . Si n cet he  eq u ati on is sy mm et ric w ithr e s p ecttothevaria bles, we maysup pose itis $x _1$. Let  $ x_1'= x_1- 9$.  Then $x_1'$ isa no nnegative  in te ger . Subs t itutin g $ x_1 ' + 9$for $x_ 1 $ i ne q ua tion 1 and simplif yi n g  y ields
$$ x_1' + x_ 2+  x_3 + x _4  +x_5= 11 \t ag{3 } $$ 
Equatio n 3 is an  e quation  i n theno nne gat ive i n tege rs wit h 
$$\bi nom{1 1  + 5 - 1}{5 -1 } = \binom{15 } {4 } $ $s olut ion s.  Hence,ther e  are  
$$ \ bi nom { 5}{1} \bino m{ 1 5} { 4}$$
cases in which  o ne ofthe v ariables viol ates a res t r i ction.
H owev e r, if we subtract  this  from thet otal, we  will  have su btractedt o o much s inc e w e h ave c ou nted each cas e in w hi ch twoofthe var iab les  vi ola te  a restri ction tw ic e,  o nc e f or ea c h way we  c oul dhav e des i gnated  oneof t he  v a ria bles as th e oneth at  vio lat es  a re stri c tio n.  The refore, w e n e ed t oad d these  cases back.Th ere are $\ bi nom {5}{2} $ ways toselect which two of the five va ria blesviol ates a re str iction . S ince t he equ ation  i s s y m metri c wi thre spect to t h e  va riabl es , we  may su ppose they are $x_ 1 $ a nd $x_2$.  Le t $ x_1' =  x _1-  9 $  an d$ x_2 ' = x_2 - 9$.  Su bstituting  $ x _1 ' + 9$ for $x_ 1$  and $x _2' + 9 $ for $x_2$ i n equatio n 1 and s im plif y i ng
{5}{1}\binom{13}{4}$$
solutions that_violate the_restrictions.
Hence, there are 
$$\binom{24}{4}_- \binom{5}{1}\binom{13}{4}$$
admissible_solutions,_so your_second_attempt was right.

How_many nonnegative integer_solutions are there to_the equation $$x_1_+_x_2 + x_3 + x_4 + x_5 = 20$$ if $x_i \leq 8$ for_$1_\leq i_\leq_5$?

In_this case, at most two_of the variables could exceed_the restrictions_since $2 \cdot 9 = 18 < 20_<_27 = 3_\cdot 9$.
Choose which of the five variables exceeds the_restriction.  Since the equation is_symmetric with respect_to_the_variables, we may suppose_it is $x_1$.  Let $x_1'_= x_1 - 9$.  Then_$x_1'$ is a nonnegative integer.  Substituting_$x_1' + 9$ for $x_1$ in_ equation 1 and simplifying_yields
$$x_1' +_x_2 + x_3 + x_4_+ x_5 =_11 \tag{3}$$
Equation_3 is an_equation in the nonnegative integers with_
$$\binom{11 + 5_- 1}{5 - 1} = \binom{15}{4}$$
solutions.__Hence, there are_
$$\binom{5}{1}\binom{15}{4}$$
cases_in_which one_of the variables_violates_a restriction.
However,_if_we subtract this from the total,_we_will have subtracted too much since we_have counted each case_in_which two of the_variables violate a restriction twice,_once for each way we could_have designated_one of_the variables as the one that violates a restriction.  Therefore,_we need to add these cases_back.
There are $\binom{5}{2}$ ways_to select_which_two of the_five_variables violates_a restriction.  Since the equation is_symmetric with_respect to the variables, we may_suppose they are $x_1$_and_$x_2$.  Let $x_1' = x_1_- 9$ and $x_2' = x_2_- 9$.  Substituting $x_1'_+_9$_for $x_1$ and $x_2' +_9$ for $x_2$ in equation 1_and simplifying