This post gives explicit bijections for the three marked-walk identities posed in item 3 of the original question. In all three cases, one side counts walks with marks that the other side moves or removes, and each cuts the walk at a position that can be found again by scanning for the first or last time some event happens, such as the first visit to a given height or the last time the walk reaches its maximum height. We will discuss the identities out of asked order, and in order of how much has to be recovered from the output, from a single hidden cut in Section 1 to an output with no mark at all in Section 3.
The same post, without the interactive diagrams, is also my answer on Math.StackExchange.
Throughout, we write for an up-step () and for a down-step (). By a balanced walk we mean a walk that ends at height zero (though it is free to dip below zero along the way). Marks sit on the vertices of a walk: writing means we have placed a mark at time , which splits the walk in two. Marks at the endpoints are allowed, and they still split the walk in two (one piece being the empty walk). Similarly, two marks divide the walk into three pieces, and are allowed to coincide (in the coinciding case, we have the middle piece be the empty walk).
1. Marked returns and the convolution identity
Let , so that a walk of length ending at height is balanced when is even and ends one step above zero when is odd. We want to understand why the number of walks of length ending at height with a marked visit to height equals the number of walks of length ending at height with a marked visit to height .
Moving a balanced piece to the front
In a target walk, the mark sits at height , so the part before the mark is a balanced walk of some even length , counted by . To produce such a walk from an input, we would like to find a balanced piece inside the input and move it to the front.
Write the input as , so that runs from height to the marked height and runs from to . Whenever visits height , the stretch of from that visit to the mark starts and ends at height . Every visit to therefore gives a candidate balanced piece (including the visit at the mark itself, whose piece is empty), and the construction has to choose one of them. Cutting at its first visit to , we write
where runs from to and reaches for the first time at its final vertex, and starts and ends at height . We write the walk as , and then transform to , moving to the front along with the mark.
After the mark, runs from to , and would then bring the walk to , a net displacement of for . However, the target walk must land at , so after it must move by instead. We solve this problem by flipping the up and down steps of , that is, by taking its bitwise complement . Thus, the final map is
Since is balanced, the mark sits at height . After the mark, moves from to and moves by , so the output ends at .
Recovering the cut
Suppose we are handed an output walk ending at height . The mark tells us where ends, and the endpoint tells us the original height, . What remains is to split back into and . The walk starts at height and may pass through height many times, and ends at one of these visits. This is why cutting at the first visit to was important, because now we can determine that ends at the first time reaches , and scanning forward from the mark will recover it. Writing at that first visit, the inverse returns , where is the walk we get after flipping the up and down steps of .
For an arbitrary target walk ending at , this first visit to always exists, because lies between and (because with ), and a walk with steps cannot get from to without passing through .
We can quickly verify that the reassembled object is a valid input and that the two maps undo each other. The prefix ends at height , and has displacement , so ends at height , as an input must. Since is balanced and begins at height , the first visit of to is still the end of , so the forward map cuts at the same place and returns , the walk we started with. Conversely, on an output of the forward map, the first-visit rule recovers the original and , and hence the original input.
In the diagram below, dragging the mark to another visit to the same height leaves alone and changes only .
Connection to the convolution
If we re-index by () so that counts input walks marked at height , then the output walk ends at height . When the zero mark in the output occurs at step , there are choices for the location of up-steps of the balanced prefix and choices for the remaining steps (which must contain up-steps to reach ). Summing over gives
which is the convolution entry OEIS A204621.
2. Pairs of zero marks
Next, we want a bijection between balanced walks of length carrying two ordered marks at height zero (which may coincide) and balanced walks of length carrying a single mark at an arbitrary vertex. Since two zero marks split a balanced walk into three independent balanced walks of lengths , this proves
Excursions
Write an input walk with two zero marks as , where , , and are balanced pieces. The output may carry only one mark, and both ends of have to be recovered from it. This is possible if we rearrange in a way that encodes the added information.
Let us rearrange into an excursion, a nonempty balanced walk that touches height zero only at its two endpoints. This is worth the trouble because, from any interior vertex of an excursion, the two endpoints are the nearest visits to height 0 on either side, so they give a natural way to turn a single mark back into two marks at height 0. Once is an excursion and the output mark is placed inside it, scanning outward from the mark recovers , the excursion, and .
The position of the mark within the excursion must also uniquely encode how was rearranged, so that the rearrangement can be undone. An excursion of length has interior vertices, so each excursion must arise from choices of , one for each position of the mark.
Rotating the middle piece
Suppose is nonempty, say of length , and that it starts with an up-step . (We return at the end of the section to the empty case and to the case where starts with a down-step , which is the same construction with all signs reversed.)
We set aside the initial up-step of for now. It will come back as the final step. The word that remains has length and net displacement . A cyclic permutation of cuts it into two pieces and swaps them to give . There are of them, one for each place to cut, since cutting at either end gives back.
We cut at its last highest point. Let that maximum height be , measured in . Since has lost the initial up-step, the cut sits at height in , and the piece from there to the end of , at , has a net displacement of . Let us call this piece , and the piece before the cut , with a displacement , so that (where may be empty). never goes back up to , because we cut at the last visit to the maximum. In , climbed from and never rose above , but if we keep at its heights in , from down to , then in the piece starts where ends, at , so every height is one lower and never reaches again either. Thus, if we move to start at , the walk stays strictly below zero after its first vertex and ends at height , and the reserved up-step climbs back to height . The walk is a negative excursion, a walk that starts at height , ends at height , and is at a negative height everywhere in between.
Cutting at an earlier visit to the maximum will not work, as the cyclic permutation reaches the last visit at the same height. Cutting below the maximum fails too, since the cyclic permutation eventually passes the maximum. Even if the maximum only comes in the part moved from the front of , where every height is one unit lower, it is still at least as high as where we started. This is the cycle lemma: a word with net displacement ( up-steps and down-steps) has exactly one cyclic permutation whose nonempty prefixes all lie strictly below zero.
We place the output mark between and , writing , so the mark records where was cut. The possible cuts correspond to the interior vertices of the excursion, which is the count required above. Since ends at height , the mark sits at height .
With the outer pieces restored, the map is
For example, consider , with and empty. The walk reaches its maximum height at steps and . Cutting at the last of these (step ) gives , so and . The map sends

Here . Moving to the front shifts it down by , while placing after shifts down by . The single mark sits at their join at height , and the initial up-step becomes the final return to zero.
Inverting the excursion map
Suppose the single mark in a balanced walk sits at some negative height . Scanning outward from the mark, the nearest vertices at height zero bound a negative excursion, and the last step of that excursion is an up-step . The mark and this final step split the excursion uniquely as , and the inverse map is
To verify that this works for every marked negative excursion with the mark at height , we trace the heights of the reassembled walk . The initial reaches height . The piece , which ran from to while staying at or below , is shifted up by , so stays at or below and ends at height . Then , which ran from to and stayed strictly below after its start, is appended at height , so it stays strictly below after the join and ends at . Consequently ends at the last maximum of , and the forward map cuts at the same place.
When starts with a down-step , the same construction with signs reversed cuts at its last minimum and maps
which produces a positive excursion with its mark at height . For the reverse map, the single mark lies at a positive height and the original walk can be found similarly. In both nonempty cases, the rearrangement is the same: a cyclic permutation of , with the set-aside first step moved to the end.
That leaves the case where the two zero marks coincide, so that is the empty walk. The forward map merges them into a single mark at height , sending . A mark at height can only come from this case, because the nonempty cases put the mark at or . So the inverse splits a mark at height back into two coincident zero marks.
In the diagram below, the single output mark lands at height only when the two zero marks are dragged together.
Bonus: The Return of the Catalans
The count from the start of this section becomes an identity if we restrict the construction to a single middle piece of length starting with up-step . The construction then gives a bijection between balanced walks of length starting with up-step , of which there are , and negative excursions of length with one interior mark. Reflecting a negative excursion of length (about the x-axis) and stripping its first and last steps produces a Dyck path of length , so there are such excursions, each with interior vertices available to mark. Equating the two counts gives the classical identity
3. Marks at a fixed height
For the last identity, we want a bijection between balanced walks of length with a marked visit to a fixed height , and binary strings of length containing at most ones. Such a bijection gives a combinatorial proof that
We assume , since otherwise both sets are empty.
Inserting a step at the mark
In this identity the output is an unmarked string, one step longer than the input, so the extra step can be inserted at the mark. An answer by natalia to an earlier question proves this sum as its equation (2) and credits GChromodynamics for help with the proof. That proof inserts a step after the marked visit to and reflects every step after it, which turns the marked visits to , minus the marked visits to , into walks of length ending at height ; the sum then follows by adding up these differences. Here we are aiming for a single bijection, so the inserted step has to be recognizable as the first or last occurrence of some event, like the first visit to in Section 1 or the last maximum in Section 2.
Suppose first that , and write the marked walk as , so that ends at height . If we insert an up-step at the mark, the new step goes from height to . For the inverse to be able to find it, we want it to be the last up-step from to in the whole walk. That will always be true if the walk never comes back down to height afterwards, but the suffix does not satisfy this condition as it stands, since it has to get from height back to . So we need to modify into a walk that stays at or above its starting height, in a way that can be undone.
As a running example, take , , and the walk .
The simplest change to would be to reflect all of it, swapping every and . This is the idea of the proof cited above, and it sends every marked walk to a string ending at height , that is, with exactly ones. But there are only such strings, far fewer than the marked walks. For and , the values of our running example, there are strings of length with five ones, but marked walks, nearly twice as many. Reflection must therefore send different marked walks to the same string, and the inverse could not tell them apart. A bijection onto strings with every number of ones up to has to keep a record, and the number of ones can be that record if we choose which steps to flip in a way the inverse can recognize.
Lifting the suffix
Which steps do we need to flip? Read as a string of parentheses, with each up-step as "(" and each down-step as ")", and match each with the most recent unmatched before it. A matched and , together with everything between them, return to the height where they started without going below it, so no matched part of takes the walk to a new low. The only steps that can are the unmatched down-steps: each lands at a height the walk has not visited before, so these are its record-low down-steps. If we turn every unmatched into a and leave the rest alone, nothing pulls the walk down any more, and it stays at or above its starting height. The inverse can run the same matching to find these steps again.
On our example suffix , scanning from left to right, the matching gives
where the boxed bits are left unmatched. In general, any unmatched preceding an unmatched would have been matched with it, so the unmatched bits always form a subsequence of the form
(in our example, , so and ). Moreover, no matched pair can straddle an unmatched bit: an enclosed would have to be matched before the outer pair could close, and an enclosed would have found the outer opening available. So the segments before, between, and after the unmatched bits are balanced detours, each staying at or above its own starting height.
We now flip those unmatched ones to zeros and leave every matched bit and every unmatched zero as it was, making the unmatched subsequence . Call the result . The balanced detours are now joined only by up-steps, so never dips below its starting height. (Up to our reversed bit convention, this is the Catalan factorization of Eğecioğlu and King, §3.)
Inserting the up-step at the mark before , the full forward map is
In our running example, flipping the two boxed ones in gives , so

Both panels plot the suffix starting at height zero. The shaded balanced detours keep their shapes and horizontal positions, while the two highlighted down-steps flip into up-steps.
Since ends at height and the whole walk is balanced, the suffix has net displacement , which means , and in particular . The input has ones, and we flipped of them, so the output has ones. The number of ones in the output thus records how many steps were flipped, which is why the target set contains strings with every number of ones up to . Finally, the inserted up-step at the mark moves from to , and stays at or above after it, so the end of is the last time the output visits height .
Inverting the map
Now suppose we are given and a binary string of length with ones. The forward map reduced the number of ones from to , so the number of bits to flip back is
Since , we have , so ends at height
In our example output, , there are ones, so unmatched zeros must be flipped back into ones.
To locate the cut, we find the last time visits height and factor there as . Since ends above , the step after that visit has to be an up-step to , and it is the step the forward map inserted. In our example, is last at height after step , which recovers and .
To decide which zeros of to flip back, we run parenthesis matching on . In the original suffix , the unmatched bits had the form , with all ones before all zeros, and flipping the ones turned this subsequence into . The flipped bits are therefore the first unmatched zeros of . The inverse turns those back into ones, and replaces the between and with the mark. On our example suffix, matching gives
and flipping the first two boxed zeros restores and the marked walk .
We still need to check that this inverse is defined on every string with ones. Since starts at and ends above , it visits height , and after its last visit the suffix stays at or above its starting height . Every in is therefore matched by a in , so has no unmatched ones, and the number of unmatched zeros in equals its net displacement:
So always has at least unmatched zeros available to flip. Flipping the first of them changes the unmatched subsequence from to , which gives a suffix of net displacement that brings the walk from height back to . Because the balanced detours between unmatched bits are never touched, matching the bits of matches the same bits as matching the bits of , and its unmatched ones are the bits that the inverse flipped. The forward map therefore flips those bits back and reinserts the step that the inverse removed, returning .
Finally, if , we complement every bit of the input walk, which reflects it vertically so that the mark sits at height . We then apply the construction for , and the inverse complements the recovered walk at the end. (When , the empty marked walk maps to .)
In the diagram below, wherever the mark is dragged, the inserted up-step is the last step from to in the output.
Construction notes
Before landing on the cyclic-permutation construction in Section 2, my initial proof composed the bijection from Section 1 with two operations from Eğecioğlu and King, §§2–3 (splitting at the last zero and converting a non-returning walk into a balanced walk). That route worked, but inverting it required chasing down several intermediate cuts. Asking whether a single interior mark could encode both endpoints of at once led to excursions and the cycle lemma.
Acknowledgements
Thank you natalia for bringing my attention to these questions! Thank you Mike Earnest for your linked answer, which led me to discover the ideas behind Catalan Factorizations!
References
Ömer Eğecioğlu and Alastair King, Random Walks and Catalan Factorization, Congressus Numerantium 138 (1999), 129–140.
Nachum Dershowitz and Shmuel Zaks, The Cycle Lemma and Some Applications, European Journal of Combinatorics 11 (1990), 35–40, §1.