Walking on an infinite gridHelp me to simplify...

I multiply the source, you (probably) multiply the output!

What is the difference between tl_to_str:V and tl_to_str:N?

How do Scrum teams manage their dependencies on other teams?

Can you mark a new target with the Hunter's Mark spell if the original target shifts to a different plane?

What's the biggest difference between these two photos?

Is future tense in English really a myth?

Supervisor wants me to support a diploma-thesis software tool after I graduated

Isn't that (two voices leaping to C like this) a breaking of the rules of four-part harmony?

Are programming languages necessary/useful for operations research practitioner?

Aftermarket seats

Are there any space probes or landers which regained communication after being lost?

Can you pop microwave popcorn on a stove?

Does the 2019 UA artificer need to prepare the Lesser Restoration spell to cast it with their Alchemical Mastery feature?

Why was "leaping into the river" a valid trial outcome to prove one's innocence?

Stack class in Java8

Online Education for OR and Developing Decision Support Systems

Short story: Interstellar inspector senses "off" nature of planet hiding aggressive culture

Capacitors with same voltage, same capacitance, same temp, different diameter?

Lost & Found Mobile Telepone

How would two worlds first establish an exchange rate between their currencies

How do you say "to hell with everything" in French?

RANK used in 'where' returns invalid column, but exists in results set

What makes an ending "happy"?

How can faith be maintained in a world of living gods?



Walking on an infinite grid


Help me to simplify $sumlimits_{i=0}^{lfloorfrac{r}{2}rfloor}binom{r}{i}binom{r-i}{r-2i}$Find number of waysNumber of walks on 2D gridCombinations/Permutations Count Paths Through GridPath counting discreteBlock walking and non-overlapping pathsNumber of words which can be read at a gridPath counting in a grid - what's the way to prove this approach?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







4












$begingroup$


I am sure someone has asked a similar question already, but I wasn't able to find it.



So lets get started: We have an infinite grid with coordinates out of $ mathbb{Z} $. Lets say the first coordinate is the X and the second is the Y. We start at some position on the grid (lets say $ (2, 2) $) and now want to go to an other position (lets say $ (42, 2) $). To do that we could go the following steps (for example):
$$A=(+1, 0)$$
$$B=(+1, +1)$$
$$C=(+1, -1)$$
Now I want to know the number of possible ways using the steps from above.



I already had some ideas - I'll list them here too for inspiration:




  1. The step A has a weight of one and the step B and C has a combined weight of 2. So my mission is to find the number of their combinations to reach 40 (see example from above).
    BUT this doesn't work because combinations like 'BAC' are also valid.


  2. I count the possible ways to perform the steps B and C: If n equals the number of steps into the right direction, so i can go B on $n-1$ steps (the last one is impossible, because for now I start with up only) and it corresponding down step can be on $n-2$ steps and so on...
    This doesn't work, because I could go on $n-1$ steps up and on the n-th all down. Additionally things like 'BCCAB' are with this model also not possible.



  3. Well, I can see a pattern there (n equals steps to the right):




    • 40xA; 0xB+C -> 1 possible way

    • 38xA; 1xB+C -> $ n * (n-1) $ possible ways

    • 36xA; 2xB+C -> $ n * (n-1) * (n-2) * (n-3) $ possible ways

    • 34xA; 3xB+C -> $ n * (n-1) * (n-2) * (n-3) * (n-4) * (n-5) $ possible ways




...so maybe something like this: $ prodlimits_{i=0}limits^{n/2-1} ( (n-i*2) * (n-i*2-1) ) $



So, anyone has an idea or hint for me?



EDIT: Added third idea.










share|cite|improve this question











$endgroup$










  • 5




    $begingroup$
    The number of paths from $(0,0)$ to $(42,2)$ is the coefficient of $t^2$ in $(t^{-1}+1+t)^{42}$.
    $endgroup$
    – Lord Shark the Unknown
    10 hours ago






  • 1




    $begingroup$
    Sir isn't it $binom{44}{2}$ . you have to walk 44 steps and you have to turn to y 2 times somewhere between. or $binom{44}{42}$ which is same
    $endgroup$
    – Rishi
    9 hours ago












  • $begingroup$
    read my comment if it helps
    $endgroup$
    – Rishi
    9 hours ago










  • $begingroup$
    Slightly different problem, but the overall reasoning might be of use math.stackexchange.com/questions/3086343/find-number-of-ways/…
    $endgroup$
    – sam wolfe
    9 hours ago










  • $begingroup$
    @Rishi Hmmm, that sound really good! Lets see... If i want to allow any number of up/down steps... Something like the sum from zero to n/2 over the binom? But why 44 steps? You start at 2 and have to get to 42 -> 40 steps! The steps from above (ABC) are ONE step (so right, up+right (=diagonal), down+right (=diagonal))!
    $endgroup$
    – Simonmicro
    9 hours ago


















4












$begingroup$


I am sure someone has asked a similar question already, but I wasn't able to find it.



So lets get started: We have an infinite grid with coordinates out of $ mathbb{Z} $. Lets say the first coordinate is the X and the second is the Y. We start at some position on the grid (lets say $ (2, 2) $) and now want to go to an other position (lets say $ (42, 2) $). To do that we could go the following steps (for example):
$$A=(+1, 0)$$
$$B=(+1, +1)$$
$$C=(+1, -1)$$
Now I want to know the number of possible ways using the steps from above.



I already had some ideas - I'll list them here too for inspiration:




  1. The step A has a weight of one and the step B and C has a combined weight of 2. So my mission is to find the number of their combinations to reach 40 (see example from above).
    BUT this doesn't work because combinations like 'BAC' are also valid.


  2. I count the possible ways to perform the steps B and C: If n equals the number of steps into the right direction, so i can go B on $n-1$ steps (the last one is impossible, because for now I start with up only) and it corresponding down step can be on $n-2$ steps and so on...
    This doesn't work, because I could go on $n-1$ steps up and on the n-th all down. Additionally things like 'BCCAB' are with this model also not possible.



  3. Well, I can see a pattern there (n equals steps to the right):




    • 40xA; 0xB+C -> 1 possible way

    • 38xA; 1xB+C -> $ n * (n-1) $ possible ways

    • 36xA; 2xB+C -> $ n * (n-1) * (n-2) * (n-3) $ possible ways

    • 34xA; 3xB+C -> $ n * (n-1) * (n-2) * (n-3) * (n-4) * (n-5) $ possible ways




...so maybe something like this: $ prodlimits_{i=0}limits^{n/2-1} ( (n-i*2) * (n-i*2-1) ) $



So, anyone has an idea or hint for me?



EDIT: Added third idea.










share|cite|improve this question











$endgroup$










  • 5




    $begingroup$
    The number of paths from $(0,0)$ to $(42,2)$ is the coefficient of $t^2$ in $(t^{-1}+1+t)^{42}$.
    $endgroup$
    – Lord Shark the Unknown
    10 hours ago






  • 1




    $begingroup$
    Sir isn't it $binom{44}{2}$ . you have to walk 44 steps and you have to turn to y 2 times somewhere between. or $binom{44}{42}$ which is same
    $endgroup$
    – Rishi
    9 hours ago












  • $begingroup$
    read my comment if it helps
    $endgroup$
    – Rishi
    9 hours ago










  • $begingroup$
    Slightly different problem, but the overall reasoning might be of use math.stackexchange.com/questions/3086343/find-number-of-ways/…
    $endgroup$
    – sam wolfe
    9 hours ago










  • $begingroup$
    @Rishi Hmmm, that sound really good! Lets see... If i want to allow any number of up/down steps... Something like the sum from zero to n/2 over the binom? But why 44 steps? You start at 2 and have to get to 42 -> 40 steps! The steps from above (ABC) are ONE step (so right, up+right (=diagonal), down+right (=diagonal))!
    $endgroup$
    – Simonmicro
    9 hours ago














4












4








4


1



$begingroup$


I am sure someone has asked a similar question already, but I wasn't able to find it.



So lets get started: We have an infinite grid with coordinates out of $ mathbb{Z} $. Lets say the first coordinate is the X and the second is the Y. We start at some position on the grid (lets say $ (2, 2) $) and now want to go to an other position (lets say $ (42, 2) $). To do that we could go the following steps (for example):
$$A=(+1, 0)$$
$$B=(+1, +1)$$
$$C=(+1, -1)$$
Now I want to know the number of possible ways using the steps from above.



I already had some ideas - I'll list them here too for inspiration:




  1. The step A has a weight of one and the step B and C has a combined weight of 2. So my mission is to find the number of their combinations to reach 40 (see example from above).
    BUT this doesn't work because combinations like 'BAC' are also valid.


  2. I count the possible ways to perform the steps B and C: If n equals the number of steps into the right direction, so i can go B on $n-1$ steps (the last one is impossible, because for now I start with up only) and it corresponding down step can be on $n-2$ steps and so on...
    This doesn't work, because I could go on $n-1$ steps up and on the n-th all down. Additionally things like 'BCCAB' are with this model also not possible.



  3. Well, I can see a pattern there (n equals steps to the right):




    • 40xA; 0xB+C -> 1 possible way

    • 38xA; 1xB+C -> $ n * (n-1) $ possible ways

    • 36xA; 2xB+C -> $ n * (n-1) * (n-2) * (n-3) $ possible ways

    • 34xA; 3xB+C -> $ n * (n-1) * (n-2) * (n-3) * (n-4) * (n-5) $ possible ways




...so maybe something like this: $ prodlimits_{i=0}limits^{n/2-1} ( (n-i*2) * (n-i*2-1) ) $



So, anyone has an idea or hint for me?



EDIT: Added third idea.










share|cite|improve this question











$endgroup$




I am sure someone has asked a similar question already, but I wasn't able to find it.



So lets get started: We have an infinite grid with coordinates out of $ mathbb{Z} $. Lets say the first coordinate is the X and the second is the Y. We start at some position on the grid (lets say $ (2, 2) $) and now want to go to an other position (lets say $ (42, 2) $). To do that we could go the following steps (for example):
$$A=(+1, 0)$$
$$B=(+1, +1)$$
$$C=(+1, -1)$$
Now I want to know the number of possible ways using the steps from above.



I already had some ideas - I'll list them here too for inspiration:




  1. The step A has a weight of one and the step B and C has a combined weight of 2. So my mission is to find the number of their combinations to reach 40 (see example from above).
    BUT this doesn't work because combinations like 'BAC' are also valid.


  2. I count the possible ways to perform the steps B and C: If n equals the number of steps into the right direction, so i can go B on $n-1$ steps (the last one is impossible, because for now I start with up only) and it corresponding down step can be on $n-2$ steps and so on...
    This doesn't work, because I could go on $n-1$ steps up and on the n-th all down. Additionally things like 'BCCAB' are with this model also not possible.



  3. Well, I can see a pattern there (n equals steps to the right):




    • 40xA; 0xB+C -> 1 possible way

    • 38xA; 1xB+C -> $ n * (n-1) $ possible ways

    • 36xA; 2xB+C -> $ n * (n-1) * (n-2) * (n-3) $ possible ways

    • 34xA; 3xB+C -> $ n * (n-1) * (n-2) * (n-3) * (n-4) * (n-5) $ possible ways




...so maybe something like this: $ prodlimits_{i=0}limits^{n/2-1} ( (n-i*2) * (n-i*2-1) ) $



So, anyone has an idea or hint for me?



EDIT: Added third idea.







combinatorics discrete-mathematics






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited 9 hours ago







Simonmicro

















asked 10 hours ago









SimonmicroSimonmicro

284 bronze badges




284 bronze badges











  • 5




    $begingroup$
    The number of paths from $(0,0)$ to $(42,2)$ is the coefficient of $t^2$ in $(t^{-1}+1+t)^{42}$.
    $endgroup$
    – Lord Shark the Unknown
    10 hours ago






  • 1




    $begingroup$
    Sir isn't it $binom{44}{2}$ . you have to walk 44 steps and you have to turn to y 2 times somewhere between. or $binom{44}{42}$ which is same
    $endgroup$
    – Rishi
    9 hours ago












  • $begingroup$
    read my comment if it helps
    $endgroup$
    – Rishi
    9 hours ago










  • $begingroup$
    Slightly different problem, but the overall reasoning might be of use math.stackexchange.com/questions/3086343/find-number-of-ways/…
    $endgroup$
    – sam wolfe
    9 hours ago










  • $begingroup$
    @Rishi Hmmm, that sound really good! Lets see... If i want to allow any number of up/down steps... Something like the sum from zero to n/2 over the binom? But why 44 steps? You start at 2 and have to get to 42 -> 40 steps! The steps from above (ABC) are ONE step (so right, up+right (=diagonal), down+right (=diagonal))!
    $endgroup$
    – Simonmicro
    9 hours ago














  • 5




    $begingroup$
    The number of paths from $(0,0)$ to $(42,2)$ is the coefficient of $t^2$ in $(t^{-1}+1+t)^{42}$.
    $endgroup$
    – Lord Shark the Unknown
    10 hours ago






  • 1




    $begingroup$
    Sir isn't it $binom{44}{2}$ . you have to walk 44 steps and you have to turn to y 2 times somewhere between. or $binom{44}{42}$ which is same
    $endgroup$
    – Rishi
    9 hours ago












  • $begingroup$
    read my comment if it helps
    $endgroup$
    – Rishi
    9 hours ago










  • $begingroup$
    Slightly different problem, but the overall reasoning might be of use math.stackexchange.com/questions/3086343/find-number-of-ways/…
    $endgroup$
    – sam wolfe
    9 hours ago










  • $begingroup$
    @Rishi Hmmm, that sound really good! Lets see... If i want to allow any number of up/down steps... Something like the sum from zero to n/2 over the binom? But why 44 steps? You start at 2 and have to get to 42 -> 40 steps! The steps from above (ABC) are ONE step (so right, up+right (=diagonal), down+right (=diagonal))!
    $endgroup$
    – Simonmicro
    9 hours ago








5




5




$begingroup$
The number of paths from $(0,0)$ to $(42,2)$ is the coefficient of $t^2$ in $(t^{-1}+1+t)^{42}$.
$endgroup$
– Lord Shark the Unknown
10 hours ago




$begingroup$
The number of paths from $(0,0)$ to $(42,2)$ is the coefficient of $t^2$ in $(t^{-1}+1+t)^{42}$.
$endgroup$
– Lord Shark the Unknown
10 hours ago




1




1




$begingroup$
Sir isn't it $binom{44}{2}$ . you have to walk 44 steps and you have to turn to y 2 times somewhere between. or $binom{44}{42}$ which is same
$endgroup$
– Rishi
9 hours ago






$begingroup$
Sir isn't it $binom{44}{2}$ . you have to walk 44 steps and you have to turn to y 2 times somewhere between. or $binom{44}{42}$ which is same
$endgroup$
– Rishi
9 hours ago














$begingroup$
read my comment if it helps
$endgroup$
– Rishi
9 hours ago




$begingroup$
read my comment if it helps
$endgroup$
– Rishi
9 hours ago












$begingroup$
Slightly different problem, but the overall reasoning might be of use math.stackexchange.com/questions/3086343/find-number-of-ways/…
$endgroup$
– sam wolfe
9 hours ago




$begingroup$
Slightly different problem, but the overall reasoning might be of use math.stackexchange.com/questions/3086343/find-number-of-ways/…
$endgroup$
– sam wolfe
9 hours ago












$begingroup$
@Rishi Hmmm, that sound really good! Lets see... If i want to allow any number of up/down steps... Something like the sum from zero to n/2 over the binom? But why 44 steps? You start at 2 and have to get to 42 -> 40 steps! The steps from above (ABC) are ONE step (so right, up+right (=diagonal), down+right (=diagonal))!
$endgroup$
– Simonmicro
9 hours ago




$begingroup$
@Rishi Hmmm, that sound really good! Lets see... If i want to allow any number of up/down steps... Something like the sum from zero to n/2 over the binom? But why 44 steps? You start at 2 and have to get to 42 -> 40 steps! The steps from above (ABC) are ONE step (so right, up+right (=diagonal), down+right (=diagonal))!
$endgroup$
– Simonmicro
9 hours ago










2 Answers
2






active

oldest

votes


















5














$begingroup$

We encode the steps with $x$ when going a step horizontally in $x$-direction and with $y$ when going vertically in $y$-direction. This way $A,B,C$ become
begin{align*}
&A=(1,0)quadto x^1y^0\
&B=(1,1)quad to x^1y^1\
&C=(1,-1) to x^1y^{-1}\
end{align*}

To go one step either $A$ or $B$ or $C$ is encoded as
begin{align*}
x+xy+frac{x}{y}
end{align*}



Note the number of paths from $(2,2)$ to $(42,2)$ is due to symmetry equal to the number of paths from $(0,0)$ to $(40,0)$. We need $40$ steps to go from $(0,0)$ to $(40,0)$ and so we consider
begin{align*}
[x^{40}y^{0}]left(x+xy+frac{x}{y}right)^{40}tag{1}
end{align*}

where we conveniently use the coefficient of operator $[x^ny^m]$ to denote the coefficient of $x^ny^m$ in a series $A(x,y)$.




We obtain
begin{align*}
color{blue}{[x^{40}y^{0}]}&color{blue}{left(x+xy+frac{x}{y}right)^{40}}\
&=[x^{40}y^0]x^{40}left(1+y+frac{1}{y}right)^{40}\
&=[y^0]sum_{k=0}^{40}binom{40}{k}left(y+frac{1}{y}right)^ktag{2}\
&=[y^0]sum_{k=0}^{40}binom{40}{k}sum_{j=0}^kbinom{k}{j}y^jy^{-(k-j)}\
&=sum_{k=0}^{40}binom{40}{k}[y^k]sum_{j=0}^kbinom{k}{j}y^{2j}tag{3}\
&=sum_{k=0}^{20}binom{40}{2k}[y^{2k}]sum_{j=0}^{2k}binom{2k}{j}y^{2j}tag{4}\
&,,color{blue}{=sum_{k=0}^{20}binom{40}{2k}binom{2k}{k}}tag{5}
end{align*}

in accordance with the result of @JeanMarie.




Comment:




  • In (2) we apply the rule $[x^p]x^q=[x^{p-q}]$ and apply the binomial theorem to $left(1+left(y+frac{1}{y}right)right)^{40}$.


  • In (3) we apply the rule $[y^p]y^q=[y^{p-q}]$ again.


  • In (4) we observe that only even powers $2j$ do contribute. So we need only to consider even indices $2k$.


  • In (5) we finally select the coefficient of $y^{2k}$.




Note:
The coefficients of $x^0$ in the expansion of $left(x+1+x^{-1}right)^n$ are called central trinomial coefficients. They do not admit a closed formula which is shown in this post.







share|cite|improve this answer











$endgroup$























    3














    $begingroup$

    First of all, your problem is equivalent to find the number of paths from $(0,0)$ to $(40,0)$. This is what we are going to assume.



    Considering $A,B,C$ as vectors, we are in a first step looking for the number of triples $(m,n,p)$ of integers such that $$mbinom{1}{0}+nbinom{1}{1}+pbinom{ 1}{-1}=binom{40}{0} iff begin{cases}m+n+p&=&40\n-p&=&0end{cases}.$$



    which amounts to say :



    $$text{Determine (first) the ordered pairs of integers} (m,n) text{such that} m+2n=40$$



    Thus, necessarily : $m=2k$ for $k=0,1,cdots 20.$ meaning that :



    $$(m,n,p)=(2k,20-k,20-k)=(0,20,20),(2,19,19),(4,18,18), etc...$$



    For each pair $(m,n)$ it remains to constitute a word of $40$ letters $A,B,C$, i.e.




    place into $40$ slots : $m=2k$ letters "$A$"s, $(20-k)$ letters "$B$"s, and $(20-k)$ letters "$C$"s as well.




    Once the $2k$ "slots" for letters "$A$" have been attributed, we have to place the same amount of letters $B$ and $C$ into the $40-2k$ remaining "slots", i.e., $20-k$ letters $B$ and as many letters "$C$". We consider only placement of letters "$B$" (Placing letters "$C$" hasn't to be considered : they occupy the remaining "slots"). This boils down to the following count :




    $$sum_{k=0}^{20} binom{40}{2k}binom{40-2k}{20-k}=sum_{k=0}^{20} frac{40 !}{(2k)! (20-k) ! (20-k) !}$$




    I don't know if one can give a close expression to this sum...






    share|cite|improve this answer











    $endgroup$


















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "69"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      noCode: true, onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });















      draft saved

      draft discarded
















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3348209%2fwalking-on-an-infinite-grid%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      5














      $begingroup$

      We encode the steps with $x$ when going a step horizontally in $x$-direction and with $y$ when going vertically in $y$-direction. This way $A,B,C$ become
      begin{align*}
      &A=(1,0)quadto x^1y^0\
      &B=(1,1)quad to x^1y^1\
      &C=(1,-1) to x^1y^{-1}\
      end{align*}

      To go one step either $A$ or $B$ or $C$ is encoded as
      begin{align*}
      x+xy+frac{x}{y}
      end{align*}



      Note the number of paths from $(2,2)$ to $(42,2)$ is due to symmetry equal to the number of paths from $(0,0)$ to $(40,0)$. We need $40$ steps to go from $(0,0)$ to $(40,0)$ and so we consider
      begin{align*}
      [x^{40}y^{0}]left(x+xy+frac{x}{y}right)^{40}tag{1}
      end{align*}

      where we conveniently use the coefficient of operator $[x^ny^m]$ to denote the coefficient of $x^ny^m$ in a series $A(x,y)$.




      We obtain
      begin{align*}
      color{blue}{[x^{40}y^{0}]}&color{blue}{left(x+xy+frac{x}{y}right)^{40}}\
      &=[x^{40}y^0]x^{40}left(1+y+frac{1}{y}right)^{40}\
      &=[y^0]sum_{k=0}^{40}binom{40}{k}left(y+frac{1}{y}right)^ktag{2}\
      &=[y^0]sum_{k=0}^{40}binom{40}{k}sum_{j=0}^kbinom{k}{j}y^jy^{-(k-j)}\
      &=sum_{k=0}^{40}binom{40}{k}[y^k]sum_{j=0}^kbinom{k}{j}y^{2j}tag{3}\
      &=sum_{k=0}^{20}binom{40}{2k}[y^{2k}]sum_{j=0}^{2k}binom{2k}{j}y^{2j}tag{4}\
      &,,color{blue}{=sum_{k=0}^{20}binom{40}{2k}binom{2k}{k}}tag{5}
      end{align*}

      in accordance with the result of @JeanMarie.




      Comment:




      • In (2) we apply the rule $[x^p]x^q=[x^{p-q}]$ and apply the binomial theorem to $left(1+left(y+frac{1}{y}right)right)^{40}$.


      • In (3) we apply the rule $[y^p]y^q=[y^{p-q}]$ again.


      • In (4) we observe that only even powers $2j$ do contribute. So we need only to consider even indices $2k$.


      • In (5) we finally select the coefficient of $y^{2k}$.




      Note:
      The coefficients of $x^0$ in the expansion of $left(x+1+x^{-1}right)^n$ are called central trinomial coefficients. They do not admit a closed formula which is shown in this post.







      share|cite|improve this answer











      $endgroup$




















        5














        $begingroup$

        We encode the steps with $x$ when going a step horizontally in $x$-direction and with $y$ when going vertically in $y$-direction. This way $A,B,C$ become
        begin{align*}
        &A=(1,0)quadto x^1y^0\
        &B=(1,1)quad to x^1y^1\
        &C=(1,-1) to x^1y^{-1}\
        end{align*}

        To go one step either $A$ or $B$ or $C$ is encoded as
        begin{align*}
        x+xy+frac{x}{y}
        end{align*}



        Note the number of paths from $(2,2)$ to $(42,2)$ is due to symmetry equal to the number of paths from $(0,0)$ to $(40,0)$. We need $40$ steps to go from $(0,0)$ to $(40,0)$ and so we consider
        begin{align*}
        [x^{40}y^{0}]left(x+xy+frac{x}{y}right)^{40}tag{1}
        end{align*}

        where we conveniently use the coefficient of operator $[x^ny^m]$ to denote the coefficient of $x^ny^m$ in a series $A(x,y)$.




        We obtain
        begin{align*}
        color{blue}{[x^{40}y^{0}]}&color{blue}{left(x+xy+frac{x}{y}right)^{40}}\
        &=[x^{40}y^0]x^{40}left(1+y+frac{1}{y}right)^{40}\
        &=[y^0]sum_{k=0}^{40}binom{40}{k}left(y+frac{1}{y}right)^ktag{2}\
        &=[y^0]sum_{k=0}^{40}binom{40}{k}sum_{j=0}^kbinom{k}{j}y^jy^{-(k-j)}\
        &=sum_{k=0}^{40}binom{40}{k}[y^k]sum_{j=0}^kbinom{k}{j}y^{2j}tag{3}\
        &=sum_{k=0}^{20}binom{40}{2k}[y^{2k}]sum_{j=0}^{2k}binom{2k}{j}y^{2j}tag{4}\
        &,,color{blue}{=sum_{k=0}^{20}binom{40}{2k}binom{2k}{k}}tag{5}
        end{align*}

        in accordance with the result of @JeanMarie.




        Comment:




        • In (2) we apply the rule $[x^p]x^q=[x^{p-q}]$ and apply the binomial theorem to $left(1+left(y+frac{1}{y}right)right)^{40}$.


        • In (3) we apply the rule $[y^p]y^q=[y^{p-q}]$ again.


        • In (4) we observe that only even powers $2j$ do contribute. So we need only to consider even indices $2k$.


        • In (5) we finally select the coefficient of $y^{2k}$.




        Note:
        The coefficients of $x^0$ in the expansion of $left(x+1+x^{-1}right)^n$ are called central trinomial coefficients. They do not admit a closed formula which is shown in this post.







        share|cite|improve this answer











        $endgroup$


















          5














          5










          5







          $begingroup$

          We encode the steps with $x$ when going a step horizontally in $x$-direction and with $y$ when going vertically in $y$-direction. This way $A,B,C$ become
          begin{align*}
          &A=(1,0)quadto x^1y^0\
          &B=(1,1)quad to x^1y^1\
          &C=(1,-1) to x^1y^{-1}\
          end{align*}

          To go one step either $A$ or $B$ or $C$ is encoded as
          begin{align*}
          x+xy+frac{x}{y}
          end{align*}



          Note the number of paths from $(2,2)$ to $(42,2)$ is due to symmetry equal to the number of paths from $(0,0)$ to $(40,0)$. We need $40$ steps to go from $(0,0)$ to $(40,0)$ and so we consider
          begin{align*}
          [x^{40}y^{0}]left(x+xy+frac{x}{y}right)^{40}tag{1}
          end{align*}

          where we conveniently use the coefficient of operator $[x^ny^m]$ to denote the coefficient of $x^ny^m$ in a series $A(x,y)$.




          We obtain
          begin{align*}
          color{blue}{[x^{40}y^{0}]}&color{blue}{left(x+xy+frac{x}{y}right)^{40}}\
          &=[x^{40}y^0]x^{40}left(1+y+frac{1}{y}right)^{40}\
          &=[y^0]sum_{k=0}^{40}binom{40}{k}left(y+frac{1}{y}right)^ktag{2}\
          &=[y^0]sum_{k=0}^{40}binom{40}{k}sum_{j=0}^kbinom{k}{j}y^jy^{-(k-j)}\
          &=sum_{k=0}^{40}binom{40}{k}[y^k]sum_{j=0}^kbinom{k}{j}y^{2j}tag{3}\
          &=sum_{k=0}^{20}binom{40}{2k}[y^{2k}]sum_{j=0}^{2k}binom{2k}{j}y^{2j}tag{4}\
          &,,color{blue}{=sum_{k=0}^{20}binom{40}{2k}binom{2k}{k}}tag{5}
          end{align*}

          in accordance with the result of @JeanMarie.




          Comment:




          • In (2) we apply the rule $[x^p]x^q=[x^{p-q}]$ and apply the binomial theorem to $left(1+left(y+frac{1}{y}right)right)^{40}$.


          • In (3) we apply the rule $[y^p]y^q=[y^{p-q}]$ again.


          • In (4) we observe that only even powers $2j$ do contribute. So we need only to consider even indices $2k$.


          • In (5) we finally select the coefficient of $y^{2k}$.




          Note:
          The coefficients of $x^0$ in the expansion of $left(x+1+x^{-1}right)^n$ are called central trinomial coefficients. They do not admit a closed formula which is shown in this post.







          share|cite|improve this answer











          $endgroup$



          We encode the steps with $x$ when going a step horizontally in $x$-direction and with $y$ when going vertically in $y$-direction. This way $A,B,C$ become
          begin{align*}
          &A=(1,0)quadto x^1y^0\
          &B=(1,1)quad to x^1y^1\
          &C=(1,-1) to x^1y^{-1}\
          end{align*}

          To go one step either $A$ or $B$ or $C$ is encoded as
          begin{align*}
          x+xy+frac{x}{y}
          end{align*}



          Note the number of paths from $(2,2)$ to $(42,2)$ is due to symmetry equal to the number of paths from $(0,0)$ to $(40,0)$. We need $40$ steps to go from $(0,0)$ to $(40,0)$ and so we consider
          begin{align*}
          [x^{40}y^{0}]left(x+xy+frac{x}{y}right)^{40}tag{1}
          end{align*}

          where we conveniently use the coefficient of operator $[x^ny^m]$ to denote the coefficient of $x^ny^m$ in a series $A(x,y)$.




          We obtain
          begin{align*}
          color{blue}{[x^{40}y^{0}]}&color{blue}{left(x+xy+frac{x}{y}right)^{40}}\
          &=[x^{40}y^0]x^{40}left(1+y+frac{1}{y}right)^{40}\
          &=[y^0]sum_{k=0}^{40}binom{40}{k}left(y+frac{1}{y}right)^ktag{2}\
          &=[y^0]sum_{k=0}^{40}binom{40}{k}sum_{j=0}^kbinom{k}{j}y^jy^{-(k-j)}\
          &=sum_{k=0}^{40}binom{40}{k}[y^k]sum_{j=0}^kbinom{k}{j}y^{2j}tag{3}\
          &=sum_{k=0}^{20}binom{40}{2k}[y^{2k}]sum_{j=0}^{2k}binom{2k}{j}y^{2j}tag{4}\
          &,,color{blue}{=sum_{k=0}^{20}binom{40}{2k}binom{2k}{k}}tag{5}
          end{align*}

          in accordance with the result of @JeanMarie.




          Comment:




          • In (2) we apply the rule $[x^p]x^q=[x^{p-q}]$ and apply the binomial theorem to $left(1+left(y+frac{1}{y}right)right)^{40}$.


          • In (3) we apply the rule $[y^p]y^q=[y^{p-q}]$ again.


          • In (4) we observe that only even powers $2j$ do contribute. So we need only to consider even indices $2k$.


          • In (5) we finally select the coefficient of $y^{2k}$.




          Note:
          The coefficients of $x^0$ in the expansion of $left(x+1+x^{-1}right)^n$ are called central trinomial coefficients. They do not admit a closed formula which is shown in this post.








          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited 4 hours ago

























          answered 4 hours ago









          Markus ScheuerMarkus Scheuer

          68.1k4 gold badges64 silver badges164 bronze badges




          68.1k4 gold badges64 silver badges164 bronze badges




























              3














              $begingroup$

              First of all, your problem is equivalent to find the number of paths from $(0,0)$ to $(40,0)$. This is what we are going to assume.



              Considering $A,B,C$ as vectors, we are in a first step looking for the number of triples $(m,n,p)$ of integers such that $$mbinom{1}{0}+nbinom{1}{1}+pbinom{ 1}{-1}=binom{40}{0} iff begin{cases}m+n+p&=&40\n-p&=&0end{cases}.$$



              which amounts to say :



              $$text{Determine (first) the ordered pairs of integers} (m,n) text{such that} m+2n=40$$



              Thus, necessarily : $m=2k$ for $k=0,1,cdots 20.$ meaning that :



              $$(m,n,p)=(2k,20-k,20-k)=(0,20,20),(2,19,19),(4,18,18), etc...$$



              For each pair $(m,n)$ it remains to constitute a word of $40$ letters $A,B,C$, i.e.




              place into $40$ slots : $m=2k$ letters "$A$"s, $(20-k)$ letters "$B$"s, and $(20-k)$ letters "$C$"s as well.




              Once the $2k$ "slots" for letters "$A$" have been attributed, we have to place the same amount of letters $B$ and $C$ into the $40-2k$ remaining "slots", i.e., $20-k$ letters $B$ and as many letters "$C$". We consider only placement of letters "$B$" (Placing letters "$C$" hasn't to be considered : they occupy the remaining "slots"). This boils down to the following count :




              $$sum_{k=0}^{20} binom{40}{2k}binom{40-2k}{20-k}=sum_{k=0}^{20} frac{40 !}{(2k)! (20-k) ! (20-k) !}$$




              I don't know if one can give a close expression to this sum...






              share|cite|improve this answer











              $endgroup$




















                3














                $begingroup$

                First of all, your problem is equivalent to find the number of paths from $(0,0)$ to $(40,0)$. This is what we are going to assume.



                Considering $A,B,C$ as vectors, we are in a first step looking for the number of triples $(m,n,p)$ of integers such that $$mbinom{1}{0}+nbinom{1}{1}+pbinom{ 1}{-1}=binom{40}{0} iff begin{cases}m+n+p&=&40\n-p&=&0end{cases}.$$



                which amounts to say :



                $$text{Determine (first) the ordered pairs of integers} (m,n) text{such that} m+2n=40$$



                Thus, necessarily : $m=2k$ for $k=0,1,cdots 20.$ meaning that :



                $$(m,n,p)=(2k,20-k,20-k)=(0,20,20),(2,19,19),(4,18,18), etc...$$



                For each pair $(m,n)$ it remains to constitute a word of $40$ letters $A,B,C$, i.e.




                place into $40$ slots : $m=2k$ letters "$A$"s, $(20-k)$ letters "$B$"s, and $(20-k)$ letters "$C$"s as well.




                Once the $2k$ "slots" for letters "$A$" have been attributed, we have to place the same amount of letters $B$ and $C$ into the $40-2k$ remaining "slots", i.e., $20-k$ letters $B$ and as many letters "$C$". We consider only placement of letters "$B$" (Placing letters "$C$" hasn't to be considered : they occupy the remaining "slots"). This boils down to the following count :




                $$sum_{k=0}^{20} binom{40}{2k}binom{40-2k}{20-k}=sum_{k=0}^{20} frac{40 !}{(2k)! (20-k) ! (20-k) !}$$




                I don't know if one can give a close expression to this sum...






                share|cite|improve this answer











                $endgroup$


















                  3














                  3










                  3







                  $begingroup$

                  First of all, your problem is equivalent to find the number of paths from $(0,0)$ to $(40,0)$. This is what we are going to assume.



                  Considering $A,B,C$ as vectors, we are in a first step looking for the number of triples $(m,n,p)$ of integers such that $$mbinom{1}{0}+nbinom{1}{1}+pbinom{ 1}{-1}=binom{40}{0} iff begin{cases}m+n+p&=&40\n-p&=&0end{cases}.$$



                  which amounts to say :



                  $$text{Determine (first) the ordered pairs of integers} (m,n) text{such that} m+2n=40$$



                  Thus, necessarily : $m=2k$ for $k=0,1,cdots 20.$ meaning that :



                  $$(m,n,p)=(2k,20-k,20-k)=(0,20,20),(2,19,19),(4,18,18), etc...$$



                  For each pair $(m,n)$ it remains to constitute a word of $40$ letters $A,B,C$, i.e.




                  place into $40$ slots : $m=2k$ letters "$A$"s, $(20-k)$ letters "$B$"s, and $(20-k)$ letters "$C$"s as well.




                  Once the $2k$ "slots" for letters "$A$" have been attributed, we have to place the same amount of letters $B$ and $C$ into the $40-2k$ remaining "slots", i.e., $20-k$ letters $B$ and as many letters "$C$". We consider only placement of letters "$B$" (Placing letters "$C$" hasn't to be considered : they occupy the remaining "slots"). This boils down to the following count :




                  $$sum_{k=0}^{20} binom{40}{2k}binom{40-2k}{20-k}=sum_{k=0}^{20} frac{40 !}{(2k)! (20-k) ! (20-k) !}$$




                  I don't know if one can give a close expression to this sum...






                  share|cite|improve this answer











                  $endgroup$



                  First of all, your problem is equivalent to find the number of paths from $(0,0)$ to $(40,0)$. This is what we are going to assume.



                  Considering $A,B,C$ as vectors, we are in a first step looking for the number of triples $(m,n,p)$ of integers such that $$mbinom{1}{0}+nbinom{1}{1}+pbinom{ 1}{-1}=binom{40}{0} iff begin{cases}m+n+p&=&40\n-p&=&0end{cases}.$$



                  which amounts to say :



                  $$text{Determine (first) the ordered pairs of integers} (m,n) text{such that} m+2n=40$$



                  Thus, necessarily : $m=2k$ for $k=0,1,cdots 20.$ meaning that :



                  $$(m,n,p)=(2k,20-k,20-k)=(0,20,20),(2,19,19),(4,18,18), etc...$$



                  For each pair $(m,n)$ it remains to constitute a word of $40$ letters $A,B,C$, i.e.




                  place into $40$ slots : $m=2k$ letters "$A$"s, $(20-k)$ letters "$B$"s, and $(20-k)$ letters "$C$"s as well.




                  Once the $2k$ "slots" for letters "$A$" have been attributed, we have to place the same amount of letters $B$ and $C$ into the $40-2k$ remaining "slots", i.e., $20-k$ letters $B$ and as many letters "$C$". We consider only placement of letters "$B$" (Placing letters "$C$" hasn't to be considered : they occupy the remaining "slots"). This boils down to the following count :




                  $$sum_{k=0}^{20} binom{40}{2k}binom{40-2k}{20-k}=sum_{k=0}^{20} frac{40 !}{(2k)! (20-k) ! (20-k) !}$$




                  I don't know if one can give a close expression to this sum...







                  share|cite|improve this answer














                  share|cite|improve this answer



                  share|cite|improve this answer








                  edited 7 hours ago

























                  answered 7 hours ago









                  Jean MarieJean Marie

                  35.7k4 gold badges26 silver badges62 bronze badges




                  35.7k4 gold badges26 silver badges62 bronze badges


































                      draft saved

                      draft discarded



















































                      Thanks for contributing an answer to Mathematics Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3348209%2fwalking-on-an-infinite-grid%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                      Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                      Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...