The solution of a generalized secretary problem via analytic expressions

Given integers 1≤k<n\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$1\le k<n$$\end{document}, the Gusein-Zade version of a generalized secretary problem is to choose one of the k best of n candidates for a secretary, which are interviewing in random order. The stopping rule in the selection is based only on the relative ranks of the successive arrivals. It is known that the best policy can be described by a non-decreasing sequence (s1,…,sk)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$(s_1, \ldots , s_k)$$\end{document} of integers with l≤sl<n\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$l\le s_l<n$$\end{document} for every 1≤l≤k\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$1\le l\le k$$\end{document}, and conversely, any such a sequence determines the general structure of the best policy. We found a finite analytic expression for the probability of success when using the optimal policy with a sequence (s1,…,sk)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$(s_1, \ldots , s_k)$$\end{document}. We also study the problem of the construction of the optimal sequence, i.e. a sequence which maximizes the corresponding probability of success. We discovered finite analytic expressions which enable to calculate the elements sl\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$s_l$$\end{document} of an optimal sequence one by one, from l=k\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$l=k$$\end{document} to l=1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$l=1$$\end{document}. Until now, such expressions were derived separately, and only for the values k≤3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$k\le 3$$\end{document}.


Introduction and the main results
In the paper we study the Gusein-Zade version of a generalized secretary problem (see Gusein-Zade 1966). There are many ways for presenting this optimal stopping problem. In the romantic version, instead of interviewing the candidates for a secretary, we have a bachelor who has an occasion to meet a certain number of girls during his bachelorhood and who found out about this number (denoted further by n) in some miraculous way. The bachelor wants to marry one of the k best girls, where k is fixed and less than n. He can not be sure of success as he follows in his live the following principles: in every time he gets to know only one of the girls and after some time he must decide to marry her or to split up. In the latter case he starts to meet the next girl, but later on he can not go back to any girl he decided to split up. The order in which he gets to know the girls is random, thus there are n! equally likely orderings. The bachelor is able to judge only the present girl or the girls he met previously, and he has no idea about the attraction of the future girls. However, we assume that no two girls will turn out equally attractive for him. The problem is to find the best policy for the bachelor, i.e. the policy which maximizes the probability of the marriage to the girl that is one of the k best. In the paper Gusein-Zade (1966) it was proved the following general structure of such a policy: Proposition 1 (Gusein-Zade (1966)) The best policy for a bachelor who wants to marry one of the k best girls is described by a certain non-decreasing sequence (s 1 , . . . , s k ) of integers with l ≤ s l < n for every 1 ≤ l ≤ k in the following way: marry the i 0 -th girl, where 1 ≤ i 0 ≤ n is the smallest integer such that there is 1 ≤ l ≤ k which satisfies: (i) s l < i 0 ≤ s l+1 (assume s k+1 := n − 1), (ii) the i 0 -th girl is one of the l best of i 0 girls met so far.
If such a number i 0 does not exists, then marry the n-th girl.
Given an arbitrary non-decreasing sequence (s 1 , . . . , s k ) of integers such that l ≤ s l < n for every 1 ≤ l ≤ k, it is natural to ask about the probability of success when using the above described policy with the sequence (s 1 , . . . , s k ). Namely, we would like to know how this probability depends on the elements of this sequence and how to construct a sequence which maximizes this probability.

Definition 1
We call a sequence (s 1 , . . . , s k ) which maximizes the probability of success for the policy described in Proposition 1 as an optimal sequence.
The classical version, i.e. the case k = 1, was solved by Lindley (1961) by using equations arising from the principle of dynamic programming. He solved these equations by simple backward recursion and obtained that the only element of an optimal sequence is equal to the smallest integer 1 ≤ x ≤ n−1 such that H (n−1)− H (x) ≤ 1, where H (x) := x j=1 1/j is the x-th harmonic number, as well as that the probability of success when using the optimal policy with an element s 1 is equal to s 1 (H (n − 1) − H (s 1 − 1))/n (see also Freeman 1983 for the survey paper). The cases k = 2, 3 were solved by using backward induction and exploiting the existence of an imbedded Markov chain. In the case k = 2 the corresponding analytic expressions were stated by Gilbert and Mosteller (1966) and the proof was outlined by Dynkin and Yushkevich (1969). The case k = 3 was derived by Quine and Law (1996).
In the present paper, we extended to an arbitrary value of k the formula for an optimal sequence in the following way.
Theorem 1 Let (s 1 , . . . , s k ) be a sequence such that s l = t l +l −1 for every 1 ≤ l ≤ k, where each t l is defined as the smallest integer 1 ≤ x ≤ n − l satisfying the inequality where and the map d l : {1, . . . , n − l} → R is defined for each 0 ≤ l ≤ k as follows: Then (s 1 , . . . , s k ) is an optimal sequence.
In the right side of (1) we use the standard conventions for the empty sum and the empty product and evaluate them to 0 and to 1, respectively. In particular, for l = k the right side of (1) just equals δ k,n /k. Hence, the above formula allows to calculate the elements s l (1 ≤ l ≤ k) one by one, from l = k down to l = 1.
In the present paper we also proved the following Theorem 2 The probability of success for the policy described in Proposition 1 is equal to where t l := s l − l + 1 for 1 ≤ l ≤ k.
The known constructions of the optimal sequence via analytic expressions were presented in the similar form as in Theorem 1 but, as we have mentioned above, only in the cases k = 1, 2, 3. For higher values of k, as well as for some other versions of this problem, the algorithms computing the probability of success and the elements of an optimal sequence can be found in various of papers (see Ajtai et al. 2001;Bruss 1984;Buchbinder et al. 2010;Chan et al. 2015;Dietzal et al. 2011;Feldman and Tennenholtz 2012;Frank and Samuels 1980;Gusein-Zade 1966;Immorlica et al. 2006;Sun et al. 2014). However, in contrast to the analytic solution, these methods apply mechanisms via dynamic or linear programming, and hence only numerically allow to determine the elements of an optimal sequence.

The strategy of the proofs
Our proofs are purely elementary and only combinatorial arguments are used. At first, since no two girls are equally attractive for the bachelor, we assign the rank to each girl, which is an integer from 1 to n, i.e. the rank 1 to the best girl, the rank 2 to the next best girl and so on. Then each of the possible n! orderings of the girls defines uniquely a permutation π of the set {1, . . . , n} such that π(i) is the rank of the i-th girl for every i ∈ {1, . . . , n}, and conversely, any permutation π of the set {1, . . . , n} defines in the obvious way the possible ordering of the girls.
Let w = (s 1 , . . . , s k ) be a non-decreasing sequence such that l ≤ s l < n for every l ∈ {1, . . . , k} and let us assume that the policy from Proposition 1 is used with the sequence w. Let π be a permutation defining the ordering of the girls. If the policy successfully chooses a candidate of top k, then we say that π is a lucky permutation corresponding to w. We distinguish the case when there exists l ∈ {1, . . . , k} such that for some i ∈ {1, . . . , n − 1} the following two conditions hold: s l < i ≤ s l+1 , -among the first i girls, there are at most l − 1 girls which are more attractive than the i-th girl (equivalently, the set {π(1), . . . , π(i)} contains at most l elements which are not greater than π(i)).
We call such a number l a w-threshold of the permutation π , and the corresponding number i we call a (π, l, w)-element (see also Definition 2 in Sect. 3). Let now assume that the permutation π has a w-threshold. If l 0 ∈ {1, . . . , k} is the smallest w-threshold of π , then the bachelor using the policy will marry to the i 0 -th girl, where i 0 is the smallest (π, l 0 , w)-element. Otherwise (i.e. when π has no w-thresholds), the bachelor will marry to the n-th girl. In particular, the set Π w of all lucky permutations corresponding to the sequence w naturally splits into two subsets: the subset Π w,1 of permutations having a w-threshold and the subset Π w,2 of permutations without w-thresholds. Obviously, the probability of success when using the policy is equal to the ratio For every l ∈ {1, . . . , k} we define the following sets: and the set X (0) := { }, where is the empty sequence. Further, we refer to the elements of the sets X (l) as words and to the elements of the sets X l as letters.
In Theorem 3 (Sect. 3), we provide for every non-decreasing sequence w = (x 1 , . . . , x k ) ∈ X (k) the analytic formulae for the cardinalities of the sets Π w,1 and Π w,2 . To derive the formula for |Π w,1 |, we consider for each 1 ≤ l ≤ k and x l < i ≤ x l+1 the subset S(l, i) ⊆ Π w,1 of all permutations π such that the number l is the smallest w-threshold of π and the number i is the smallest (π, l, w)-element. In particular, we can write Further, for every π ∈ S(l, i), we divide the set {π(1), . . . , π(i)} into two subsets: the subset of those elements which are not greater than k and the subset of those elements which are greater than k. Conversely, given arbitrarily the sets Y & and Y such that Then, we have: where the set M j ( j ∈ {1, . . . , k}) consists of the pairs (Y, Y ) in which |Y | = j. In Proposition 2, we provide the characterization of elements in the set S(Y, Y , l, i), which allows to find the following formula for its cardinality: We use the above formula to find the cardinality of the set S(l, i) and, consequently, the following formula for |Π w,1 |: where the map r l : {l + 1, . . . , n} → R is defined for every integer l ≤ k as follows: By using a similar idea as in Proposition 2, we also characterize the elements of the set Π w,2 (see Proposition 5), which gives the following formula for |Π w,2 |: In Sect. 4, we derive the formula for the elements of an optimal sequence. To this aim, we introduce the notion of an optimal point (see Definition 3) of an arbitrary map f : Z → R, where Z ⊆ X (l) or Z ⊆ X l for some l ∈ {1, . . . , k}. Next, we define for every l ∈ {0, 1 . . . , k} a map T l : X (k−l) → R (see formula (14)), which constitutes a natural generalization of the map We study the maps T l in relation to the maps c l , D l (l ∈ {0, . . . , k}) and F l,w (l ∈ {1, . . . , k}, w ∈ X (k−l) ) defined as follows: where in (7) the letter x 1 denotes the first letter of a word w ∈ X (k−l) or x 1 := n − 1 depending on whether l < k or l = k. In particular, we obtain In Proposition 6, we show how to describe the maps D l in terms of the maps d l . As a result, we obtain for every l ∈ {1, . . . , k} that the right side of (1) is equal to where w (l) ∈ X (k−l) arises from the sequence w := (t 1 , t 2 + 1, . . . , t k + k − 1) by deleting the first l letters. In Proposition 7, for any l ∈ {1, . . . , k} and w ∈ X (k−l) , we show that if t is the smallest element x ∈ {1, . . . , n−l} such that d l (x) ≤ D l (w)/l, then the number t +l −1 is an optimal point of the map F l,w . Next, we show (Proposition 8) that an arbitrary sequence w ∈ X (k) is an optimal point of the map T if and only if for every l ∈ {1, . . . , k} the l-th letter of w is an optimal point of the map F l,w (l) . Finally, in Proposition 9, we show that if w ∈ X (k) is an optimal point of T , then w must be a non-decreasing sequence. As a simple consequence of Theorem 3 and the above propositions, we obtain our main results (see Sect. 5). The proofs of Propositions 6-9 are based on various combinatorial identities and on some auxiliary properties of the maps r l , c l , D l and F l,w . We derive them in Sect. 6. Further, we use for all i, j ∈ Z the following notations:

The formula for the probability of success
Let Sym(n) be the set of all permutations of the set [n]. For every π ∈ Sym(n) and every i ∈ [n] we call the image π(i) the π -rank of the element i. We call the element i a π -candidate if π(i) ∈ [k]. In particular, if the ordering of the girls is defined by a permutation π ∈ Sym(n), then the bachelor's win is to marry to the i 0 -th girl, where i 0 ∈ [n] is an arbitrary π -candidate. For every π ∈ Sym(n) and every i ∈ [n] we also consider the relative π -rank of the element i, i.e. the number of the elements from the set [i] such that their π -ranks are not greater than π(i); we denote this number by ρ π (i). In other words, ρ π (i) is the number of those elements from the set π([i]) which are not greater than π(i).
Definition 2 Let π ∈ Sym(n), l ∈ [k] and let w = (s 1 , . . . , s k ) ∈ X (k) be a non-decreasing sequence. We call an arbitrary element i ∈ [s l , s l+1 ] satisfying the inequality ρ π (i) ≤ l a (π, l, w)-element. If the set [s l , s l+1 ] contains at least one (π, l, w)-element, then we call the number l a w-threshold of the permutation π . In other words, the element l ∈ [k] is a w-threshold of π if there is i ∈ [s l , s l+1 ] such that ρ π (i) ≤ l (as before, we assume s k+1 := n − 1).
Let now assume that the bachelor uses the policy from Proposition 1 with a sequence w = (s 1 , . . . , s k ) and that the ordering of the girls is defined by a permutation π ∈ Sym(n). Then π is a lucky permutation corresponding to w if and only if one of the following conditions holds: π has a w-threshold and if l 0 ∈ [k] is the smallest w-threshold of π , then the smallest (π, l 0 , w)-element is a π -candidate, -π has no w-thresholds and the element n is a π -candidate.
Theorem 3 Let w 0 = (x 1 , . . . , x k ) ∈ X (k) be a non-decreasing sequence. Then the number of lucky permutations corresponding to w 0 and having a w 0 -threshold is equal to where the maps r l : [l, n] → R(l ∈ [≤ k]) are defined as in (5). The number of lucky permutations corresponding to w 0 and having no w 0 -thresholds is equal to we determine the number of lucky permutations π ∈ Π w 0 such that l 0 is the smallest w 0 -threshold of π and i 0 is the smallest (π, l 0 , w 0 )-element. Let us denote by S(l 0 , i 0 ) the set of all such permutations.
and X π ⊆ [k, n], all these elements must belong to the set X π . In particular, if we denote X π := {y 1 , . . . , y j 0 } for some j 0 ∈ [k], where y 1 < y 2 < . . . < y j 0 , then we obtain: π(i 0 ) = y ι for some 1 ≤ ι ≤ min{ j 0 , l 0 }. Note that ι is the relative π -rank of the element i 0 . Let Y, Y ⊆ [n] be arbitrary subsets which satisfy the following conditions Let us denote Proposition 2 For every permutation π ∈ S(Y, Y , l 0 , i 0 ) the following three conditions hold: Conversely, if the sets Y, Y satisfy (9) and a permutation π ∈ Sym(n) satisfies the Proof (of Proposition 2) Let π ∈ S(Y, Y , l 0 , i 0 ) be arbitrary. By the above reasoning, the conditions (i)-(ii) directly follow from the equalities Y = X π and Y = X π . To justify (iii) let us assume contrary that there is Thus the set π([i 1 ]) contains at most j 1 elements which are not greater than y j 1 = π(i 1 ). Hence the relative π -rank of the element i 1 is not greater than j 1 , i.e. ρ π (i 1 ) ≤ j 1 . Since the sequence (x j 1 , . . . , But ρ π (i 1 ) ≤ j 1 ≤ j 2 , and hence i 1 is a (π, j 2 , w 0 )-element. Consequently j 2 is a w 0 -threshold of π . Since j 2 ≤ l 0 and l 0 is the smallest w 0 -threshold of π , we obtain: j 2 = l 0 . Consequently, the element i 1 is a (π, l 0 , w 0 )-element. Since i 1 < i 0 , we obtain the contradiction with the assumption that i 0 is the smallest (π, l 0 , w 0 )-element. This justifies the first part of Proposition 2.

Proposition 3 The number of elements in the
where j 0 := |Y |.

Proof (of Proposition 3)
We use the characterization of the set S(Y, Y , l 0 , i 0 ) from Proposition 2. By the conditions (i)-(iii), we see that every permutation π ∈ S(Y, Y , l 0 , i 0 ) can be constructed as follows. At first, we choose arbitrarily an element ι ∈ [μ j 0 ,l 0 ] and define: π(i 0 ) := y ι . We can do that in μ j 0 ,l 0 ways. Next, for every j ∈ [l 0 ] we choose an element i j ∈ [x j ] and define π(i j ) := y j . We can do that in l 0 j=1 (x j − j + 1) ways. Further, we define the π -ranks from the set Namely, for every y ∈ Y we choose an element i y ∈ [i 0 − 1] \ {i 1 , . . . , i l 0 } and define π(i y ) := y. We can do that in (i 0 − l 0 − 1)! ways. Finally, we define the π -ranks from the set [n]\(Y ∪Y ), i.e. for every i ∈ [n]\[i 0 ] we choose an element y i ∈ [n]\(Y ∪Y ) and define π(i) := y i . We can do that in (n − i 0 )! ways. Hence, the claim directly follows from the above construction.

Proof (of Proposition 4)
We have: where for every j ∈ [k] we define Since |M j | = k j n−k i 0 − j , we obtain from Proposition 3: where From the Vandermonde's identity, we obtain The claim now follows from (13).
Obviously, the number of all lucky permutations from Π w 0 which have a w 0threshold is equal to k l=1 x l+1 i=x l +1 |S(l, i)|. We see by Proposition 4 that this double sum can be written as follows The crucial point for the further study, which also finishes the proof of the first part of Theorem 3, is the observation that the sum x l+1 i=x l +1 lr l (i) in the above expression can be written in a closed form as follows: The last equality follows from the identity lr l (x) = r l−1 (x) − r l−1 (x − 1) for all l ∈ [≤ k] and x ∈ [l, n], which we derive in Sect. 6 (see Lemma 2 (iii) therein).
To show the second part of Theorem 3, we provide the following characterization of all lucky permutations from Π w 0 which have no w 0 -thresholds.

Conversely, if π ∈ Sym(n) is an arbitrary permutation which satisfies (i)-(ii)
, then π is a lucky permutation corresponding to w 0 and π has no w 0 -thresholds.
Conversely, let π ∈ Sym(n) be an arbitrary permutation which satisfies (i)-(ii). We show that π is a lucky permutation corresponding to w 0 and π has no w 0 -thresholds. By (i), it is enough to show that π has no w 0 -thresholds. We proceed in the similar way as in the proof of Proposition 2. Namely, suppose contrary that π has a w 0 -threshold. Then there are j 0 ∈ [k] and i 0 ∈ [x j 0 , x j 0 +1 ] such that ρ π (i 0 ) ≤ j 0 . By (ii), we have , then π(i 0 ) > y j 0 and consequently ρ π (i 0 ) ≥ j 0 + 1. Thus, it must be π(i 0 ) ∈ [k + 1] \ {ι} (note that i 0 = n and hence Thus it must be j 1 > j 0 and consequently ρ π (i 0 ) ≥ j 0 + 1 contrary to our assumption. This finishes the proof of Proposition 5. By using the conditions (i)-(ii) from Proposition 5, we see that every lucky permutation π ∈ Π w 0 without w 0 -thresholds can be constructed as follows. At first, we choose arbitrarily an element ι ∈ [k] and we define: π(n) := ι. We can do that in k ways. Next, we choose for every j ∈ [k] an element i j ∈ [x j ] and define π(i j ) := y j . This can be done in k j=1 (x j − j + 1) ways. Finally, we define the π -ranks from the set [n] \ {ι, y 1 , . . . , y k }, which can be done in (n − k − 1)! ways. As a result of this construction, we obtain the required formula. This completes the proof of Theorem 3.

The formula for an optimal sequence
Let T : X (k) → R be the map defined for every w = (x 1 , . . . , x k ) ∈ X (k) as follows: and ξ k,n := k(n − k − 1)!/n!. We see by Theorem 3 that the probability of success for the policy described in Proposition 1 is equal to T (w 0 ), where w 0 = (s 1 , . . . , s k ).
for every w ∈ Z an optimal point of this map.
In particular, we see that if w 0 ∈ X (k) is an optimal point of the map T , then w 0 is an optimal sequence (see Definition 1) if and only if it is a non-decreasing sequence. In this section, we show (see Proposition 9) that every optimal point of the map T is indeed a non-decreasing sequence, which implies that every optimal point of T is simultaneously an optimal sequence. We also derive the formula for an optimal point of T (see Propositions 7,8). For this aim, we introduce certain natural generalizations of this map. Namely, for every l ∈ [k] 0 we define the map T l : X (k−l) → R as follows: where the maps R l, j , Γ l, j, j : X (k−l) → R(l ∈ [k] 0 , j, j ∈ [n] 0 ) are defined as follows (in the formula for R l, j below we assume x k−l+1 := n − 1): 1, otherwise.
In particular T 0 = T and T k = ξ k,n .
Let us consider the maps D l (l ∈ [k] 0 ) defined by (7). In Sect. 6, we derive some properties of these maps (see Lemma 4 therein), which allows to describe them in terms of the maps d l defined by (3) in the following way.
Proposition 6 For every w = (x 1 , . . . x k ) ∈ X (k) and every l ∈ [k] 0 we have where σ : X (k−l) → X (k−l−1) is a left-shift operator removing the first letter from a non-empty word and x i : Proof The case l = k directly follows from the equality D k ( ) = δ k,n (see Lemma 4 (i)). In the case l ∈ [k − 1] 0 , we have by Lemma 4 (ii) where the map c l is defined by (6). Hence, since c l (x l+1 ) = d l ( x l+1 ), we can write By easy induction on m, we can extend the last formula as follows: for every l ∈ [k − 1] 0 and m ∈ [l − 1, k − 1]. The claim now follows by taking m := k − 1 in (15).
Let F l,w (l ∈ [k], w ∈ X (k−l) ) be the maps defined by (8). In the proof of the next proposition, we use some properties of the maps c l , which we derive in Sect. 6.
Proposition 7 Let l ∈ [k] and w ∈ X (k−l) . If s is the smallest number x ∈ [l − 1, n − 1] such that c l (x + 1) ≤ D l (w)/l, then s is an optimal point of the map F l,w . Consequently, if t is the smallest number x ∈ [n − l] such that d l (x) ≤ D l (w)/l, then t + l − 1 is an optimal point of F l,w .
Proof For every x ∈ [l − 1, n − 2] the following equality holds: Indeed, directly by the definition of the map F l,w , the left side of (16) is equal to for all x ∈ [l − 1, n − 1] (see Lemma 3 (iii) in Sect. 6), is equal to the right side of (16). Hence, the first part follows from (16) and from the fact that the map c l is non-increasing (see Lemma 3 (iv)). The second part follows now from the equalities The below proposition is based on the observation that for every word w = (x 1 , . . . , x k ) ∈ X (k) and every l ∈ [k] there are A ∈ R + , B ∈ R which do not depend on the letter x l and such that T (w) = A · F l,σ l (w) (x l ) + B (for the proof see Lemma 5 in Sect. 6). w = (x 1 , . . . , x k ) ∈ X (k) is an optimal point of the map T if and only if for every l ∈ [k] the letter x l is an optimal point of the map F l,σ l (w) .

Proposition 8 A sequence
Proof Suppose, contrary, that the sequence w = (x 1 , . . . , x k ) is an optimal point of T and there is l ∈ [k] such that the letter x l is not an optimal point of F l,σ l (w) . Let x l ∈ X l be an optimal point of F l,σ l (w) and let w ∈ X (k) be the word arising from w by replacing the l-th coordinate with x l . Since σ l (w ) = σ l (w), we have: Consequently T (w ) > T (w), which contradicts with the assumption that w is an optimal point of T .
Conversely, let w = (x 1 , . . . , x k ) ∈ X (k) be such that for every l ∈ [k] the letter x l is an optimal point of the map F l,σ l (w) . We show that w is an optimal point of T . Let v = (y 1 , . . . , y k ) ∈ X (k) be an arbitrary optimal point of the map T . Let us define the words w l ∈ X (k) (0 ≤ l ≤ k) as follows: w 0 := w, w k := v and w l := (y 1 , . . . , y l , x l+1 , . . . , x k ) for every l ∈ [k − 1]. In particular, for each l ∈ [k] the two words w l−1 and w l differ only in the l-th position, which is equal to x l in w l−1 and to y l in w l . Hence, by Lemma 5, there are A ∈ R + and B ∈ R such that Since the letter x l is an optimal point of F l,σ l (w) and σ l (w l−1 ) = σ l (w l ) = σ l (w), we have T (w l−1 ) ≥ T (w l ). Consequently, we obtain the inequalities: Since v is an optimal point of T , we have T (w) = T (v). Thus w is an optimal point of T .
The proof of the next proposition is based on various properties of the maps D l , c l (l ∈ [k] 0 ), which we derive in Sect. 6 (see Lemmas 3, 4).

Proposition 9
If w = (x 1 , . . . , x k ) ∈ X (k) is an optimal point of the map T , then w is a non-decreasing sequence.
Proof Let w = (x 1 , . . . , x k ) be an optimal point of the map T . By Proposition 8, we see that for every l ∈ [k] the letter x l is an optimal point of the map F l,σ l (w) . Let us fix l ∈ [k] \ {1} and let us denote x := x l−1 , y := x l , v := σ l (w). We have to show that x ≤ y. We can assume that x = l − 1 and y = n − 1. Since x and y are optimal points of F l−1yv and F l,v , respectively, we obtain: Since y − l + 1 > 0, we obtain from the first of the inequalities in (17): But from Lemma 4 (ii), we have The second inequality in (17) gives: From (18)-(20), we obtain: Since l · c l (y + 1) = c l−1 (y) − c l−1 (y + 1) (see Lemma 3 (iii)), we obtain or equivalently: But the right side of (22) is equal to (see Lemma 3 (v)), which in the case y ≤ n−k+l −2 is a positive number. Consequently, we have c l−1 (x)−c l−1 (y+1) > 0 in this case. Since the map c l−1 is non-increasing (see Lemma 3 (iv)), we have x ≤ y. So, we can assume y ≥ n − k + l − 1. In the case l ≥ 3 we have D l−1 (yv) > 0 by Lemma 4 (iii), and hence, by (17), we obtain in this case: c l−1 (x) > 0. But then, directly from the definition of the map c l−1 , we have Thus there must be j ∈ [l − 3] 0 such that n − k ≥ x − 1 − j. Consequently x ≤ n − k + 1 + j ≤ n − k + l − 2 < y. Hence, we can assume l = 2. Then by (19), we have D 1 (yv) − c 1 (y) = (y − 1) · D 2 (v) and by the second inequality in (17), we have c 1 (x) ≥ D 1 (yv). Hence c 1 (x) − c 1 (y) ≥ (y − 1) · D 2 (v) > 0, where the last inequality follows from Lemma 4 (iii). Since the map c 1 is non-increasing, we obtain x < y, which finishes the proof.

The proofs of Theorems 1-2
The main results are a straightforward consequence of Theorem 3 and Propositions 6-9.
In the case l ∈ [1, k], by the item (i), we obtain that the difference (x + 1 − l)c l (x) − xc l (x + 1) is equal to which is equal to by the equality (26) from Lemma 1.

Lemma 4
The maps D l (l ∈ [k] 0 ) have the following properties: , where x 1 denotes the first letter of w, (iii) D l (w) > 0 for each l ∈ [1, k] and w ∈ X (k−l) .

Conclusion
In the present paper, we obtained the analytic formulae for an optimal sequence (s 1 , . . . , s k ) in the Gusein-Zade version Gusein-Zade (1966) of a generalized secretary problem. In this problem, the interviewer would like to choose one of the k best of n candidates arriving in random order and the stopping rule is based on the relative ranks of the successive arrivals. For any sequence (s 1 , . . . , s k ) describing the optimal policy, we also found the analytic formula for the probability of success when using the policy with this sequence. Our original approach is purely elementary and bases on the combinatorial analysis of the problem. The obtained formulae reveal the possibility of an extension to an arbitrary value of k for closed expressions describing the elements of an optimal sequence. Until now such expressions were derived only for k ≤ 3. Since the maps d l in the inequalities (1) describing the optimal sequence are all non-increasing, our formula reduces the determination of elements in this sequence to solving a system of k equations. In other words, we need to solve a recurrence with the number of steps bounded by k, which is substantially more advantageous than the implicit solution via computing the optimum from the known mechanism of dynamic or linear programming. On the other hands, in recent years, the linear programming approach was discovered to analyze a broader class of secretary problems. For example, in Buchbinder et al. (2010) the authors consider a so-called J -choice K -best secretary problem (the case J = 1 was the subject of the present paper), where finding of an optimal solution reduces to solving the corresponding linear program. In Chan et al. (2015) the authors use linear programming but to the so-called continuous and infinite models of the secretary problem (see also Bruss 1984;Immorlica et al. 2006). In Sun et al. (2014) even a more general problem is studied via this technique -a so called shared Q-queue J -choice K -best secretary problem. Therefore, it seems natural to analyze and develop our combinatorial approach also for wider classes of secretary problems, which might result in finding some simplifications in the corresponding formulae. The construction of the optimal sequence from Theorem 1 could also be applied in the study of the limits τ l (k) := lim n→∞ s l /n (1 ≤ l ≤ k) and their behaviour. This could help in solving some (according to our knowledge) open questions concerning these limits, such as (see also Frank and Samuels 1980;Freeman 1983): Is it true that τ 1 (k) monotonically decreases with k?
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.