# Using a Semantic Knowledge Base to Improve the Management of Security
Reports in Industrial DevOps Projects

Markus Voggenreiter<EMAIL_ADDRESS>0000-0003-3964-1983
Siemens Technology and LMU MunichMunichGermany and  Ulrich Schöpp
<EMAIL_ADDRESS>fortiss GmbHMunichGermany

(2022)

###### Abstract.

Integrating security activities into the software development lifecycle to
detect security flaws is essential for any project. These activities produce
reports that must be managed and looped back to project stakeholders like
developers to enable security improvements. This so-called Feedback Loop is a
crucial part of any project and is required by various industrial security
standards and models.

However, the operation of this loop presents a variety of challenges. These
challenges range from ensuring that feedback data is of sufficient quality
over providing different stakeholders with the information they need to the
enormous effort to manage the reports. In this paper, we propose a novel
approach for treating findings from security activity reports as belief in a
Knowledge Base (KB). By utilizing continuous logical inferences, we derive
information necessary for practitioners and address existing challenges in the
industry. This approach is currently evaluated in industrial DevOps projects,
using data from continuous security testing.

††journalyear: 2022††copyright: acmlicensed††conference: 44nd International
Conference on Software Engineering: Software Engineering in Practice; May
21–29, 2022; Pittsburgh, PA, USA††booktitle: 44nd International Conference on
Software Engineering: Software Engineering in Practice (ICSE-SEIP ’22), May
21–29, 2022, Pittsburgh, PA, USA††price: 15.00††doi:
10.1145/3510457.3513065††isbn: 978-1-4503-9226-6/22/05††ccs: Security and
privacy Software security engineering††ccs: Theory of computation Automated
reasoning

##  1\. Introduction

Automating security activities like periodic testing for vulnerabilities and
flaws is essential in industrial projects utilizing DevOps techniques (Moyón
et al., 2020; Kim, 2011) to produce software products in domains with high
security-related demand. As a result, new data about the software security is
continuously generated, informing about shortcomings of the software and new
requirements. In order to improve the product, reports must be fed back into
the development cycle and be addressed by developers (Simpson, 2014). This so-
called Feedback Loop is demanded by various standards and industry best
practices ((IEC), 2018; Migues et al., 2020).

In practice, however, the task of implementing the Feedback Loop presents
various challenges. The first challenge is the quality of the reports. The
vast amount of data produced by security activities varies in format, content,
perspective, assumptions, and evaluation (Welberg, 2008), which necessitates
data processing. Issues like False Positives are common in reports (Nadeem et
al., 2012), reducing their reliability. The second challenge is how the data
is utilized. The correct interpretation of the security activity data is
essential for the subsequent actions, as data itself fuels project decisions
and represents the software’s security level. Moreover, each project has its
own demands, e.g., regarding standards compliance. Consequently, a high-
quality demand applies to the produced information and must be customized
project-wise. Our third challenge is that data from security activities is
only half of what is needed. Inputs by security experts, customer opinion, or
vulnerability databases are essential to correctly estimate the impact of
findings and present a valid representation of reality. Finally, performing
the management manually to collate actionable information is neither feasible
in industrial software development projects nor conforming with the DevOps
mindset, where automation of tasks is crucial (Leite et al., 2019). Hence, we
see a necessity to address the question:
How can the Feedback Loop for security reports in industrial DevOps projects
be optimized?
The optimization should include the process being faster, customizable, with
the least manual effort, more automation, highly reliable, and comprehensible
for the project team.

##  2\. Using a Semantic Knowledge Base

###  2.1. Theory

We propose the usage of a semantic KB to address the challenges identified
above. A KB comprises primary information, logically interconnected by
database semantics and stored free of constraints in a metastructural
database. In contrast to a database, a KB has primary methods of data
processing, which allow the continuous generation of new information based on
existing data (Krótkiewicz et al., 2018, 2016). KB s have been applied in
various areas, including management of sensor data (Nambi et al., 2014), the
elicitation of high-quality requirements (Kaiya and Saeki, 2006), and even
vulnerability management (Wang and Guo, 2009). In contrast to existing
approaches, we apply KB s to the domain of secure software engineering to
manage security reports. However, this implies multiple changes to existing
concepts to ensure a successful function in this use case. Initially, we
consider the content of the KB as belief instead of knowledge due to the lack
of data reliability. This particularly includes contradictory information from
our data sources. Consequently, belief must be revisable, including the
explicit belief (provided from outside the KB) and derived belief (derived by
the KB). Moreover, the inference procedure must be customized to each project.
This implies that each KB has to deal with belief and inference rules being
incrementally added or changed throughout the project. As each KB is unique to
its project, a traditional approach using a static ontology is not feasible
for our use case, especially when considering changing inference rules.
Instead, we enable the incremental creation of a KB for each project. To
ensure a consistent KB, we monitor all changes to the KB and identify
contradictory information. If conflicting data is identified, it is resolved
by considering external human input as more reliable (e.g., False Positive
identification). Any belief derived from the formerly contradictory
information is revised and re-calculated.

With this approach, we can address various challenges of the industrial
security report management with a semantic KB. The automated generation of
data with pre-written inference rules ensures high reliability, high
comprehensibility, project customization and reduces the scope for human
errors. The automation of the report management reduces the manual effort and
speeds up processing.

###  2.2. Practice

In order to test our theoretical concept, we implemented it for industrial
software development projects. We realized our concepts of belief, inference
rules, continuous inference, and metastructural data storage in the components
depicted in Figure 1.

Figure 1. Component Overview of Example KB

The Data Storage component, which comprises rules and belief, is implemented
using the Elasticsearch search engine, which allows us to perform advanced
queries on the data. Belief is stored in entities of Elasticsearch documents.
Inference rules, however, are written in Python code. The step where our
inference rules are applied to the current content of the KB to derive new
information is implemented by the Inference Engine. With the Logical Core, we
ensure consistency between new beliefs being added or existing beliefs being
revised. These components are implemented in Python, using a self-developed
logic to ensure consistency within the KB. Investigating the connections to
incremental logic programming approaches, such as Differential Datalog
(VMware, 2022), is an interesting direction for future work.

In practice, each project has to customize the information contained in the KB
by writing documents for belief and inference rules. Based on our experience,
specific inference rules are necessary for any project. These include a parser
for security reports, a deduplication between findings, a validation of
findings using human expertise, and a prioritization of the resulting issues.
In most cases, these inference rules are streamlined, meaning that they build
upon each other in a pipeline-like manner. To avoid the artificial inflation
of the KB, we restrict new inferences solely to those that might be
invalidated by external input (e.g., incorrect deduplication).

Deduplication, e.g., works on findings that have been parsed before from the
original reports. During the execution of this rule, findings with similar
values for title or description are summarized. As this could incorrectly
connect two findings, external input correcting potentially flawed inferences
is considered during execution. In such cases, the logical core would
investigate whether this makes a revision of belief necessary. We are
currently utilizing this KB in industrial software development projects to
manage reports from automated security testing to evaluate its relevance and
usefulness.

##  3\. Conclusion and Future

The management of reports produced by security activities in industrial DevOps
projects is essential in every domain. In this paper, we suggest a novel
approach of using a semantic KB for this use case. We indicate necessary
changes to existing KB concepts and introduce our concept implementation. We
believe that utilizing logical inferences in combination with the reliability
of a KB is a promising approach for usage in industrial software engineering
projects. Substantiating this belief with a long-term evaluation in a
realistic setting will be the core activity of future work.

## References

  * (1)
  * (IEC) (2018) International Electrotechnical Commission (IEC). 2018.  _62443-4-1_.  Security for industrial automation and control systems Part 4-1 Product security development life-cycle requirements.
  * Kaiya and Saeki (2006) H. Kaiya and M. Saeki. 2006.  Using Domain Ontology as Domain Knowledge for Requirements Elicitation. In _14th IEEE International Requirements Engineering Conference (RE’06)_. 189–198.
  * Kim (2011) Gene Kim. 2011.  _Top 11 Things You Need to Know About DevOps_.
  * Krótkiewicz et al. (2018) Marek Krótkiewicz, Krystian Wojtkiewicz, and Marcin Jodłowiec. 2018.  Towards Semantic Knowledge Base Definition. In _Biomedical Engineering and Neuroscience_ , Wojciech P. Hunek and Szczepan Paszkiel (Eds.). Springer International Publishing, Cham, 218–239.
  * Krótkiewicz et al. (2016) Marek Krótkiewicz, Krystian Wojtkiewicz, Marcin Jodłowiec, and Waldemar Pokuta. 2016\.  Semantic Knowledge Base: Quantifiers and Multiplicity in Extended Semantic Networks Module. In _Knowledge Engineering and Semantic Web_ , Axel-Cyrille Ngonga Ngomo and Petr Křemen (Eds.). Springer International Publishing, Cham, 173–187.
  * Leite et al. (2019) Leonardo Leite, Carla Rocha, Fabio Kon, Dejan Milojicic, and Paulo Meirelles. 2019.  A Survey of DevOps Concepts and Challenges.  _ACM Comput. Surv._ 52 (Nov. 2019).
  * Migues et al. (2020) Sammy Migues, John Steven, and Mike Ware. 2020.  _BSIMM 11_.
  * Moyón et al. (2020) Fabiola Moyón, Rafael Soares, Maria Pinto-Albuquerque, Daniel Mendez, and Kristian Beckers. 2020\.  Integration of Security Standards in DevOps Pipelines: An Industry Case Study. In _Product-Focused Software Process Improvement_ , Maurizio Morisio, Marco Torchiano, and Andreas Jedlitschka (Eds.). Springer International Publishing, Cham, 434–452.
  * Nadeem et al. (2012) Muhammad Nadeem, Byron J. Williams, and Edward B. Allen. 2012\.  High False Positive Detection of Security Vulnerabilities: A Case Study. In _Proceedings of the 50th Annual Southeast Regional Conference_ (Tuscaloosa, Alabama) _(ACM-SE ’12)_. Association for Computing Machinery, New York, NY, USA, 359–360.
  * Nambi et al. (2014) S. N. A. U. Nambi, C. Sarkar, R. V. Prasad, and A. Rahim. 2014.  A unified semantic knowledge base for IoT. In _2014 IEEE World Forum on Internet of Things (WF-IoT)_. 575–580.
  * Simpson (2014) Stacy Simpson. 2014\.  SAFECode Whitepaper: Fundamental Practices for Secure Software Development 2nd Edition. In _ISSE 2014 Securing Electronic Business Processes_ (Wiesbaden), Helmut Reimer, Norbert Pohlmann, and Wolfgang Schneider (Eds.). Springer Fachmedien Wiesbaden, 1–32.
  * VMware (2022) VMware. 2022.  _Differential Datalog (DDlog)_.  https://github.com/vmware/differential-datalog original-date: 2018-03-20.
  * Wang and Guo (2009) J. A. Wang and M. Guo. 2009.  Security Data Mining in an Ontology for Vulnerability Management. In _2009 International Joint Conference on Bioinformatics, Systems Biology and Intelligent Computing_. 597–603.
  * Welberg (2008) S.M. Welberg. 2008\.  _Vulnerability management tools for COTS software - A comparison_.  Number TR-CTIT-08-15 in CTIT Technical Report Series. Centre for Telematics and Information Technology (CTIT), Netherlands.


# Square wells, quantum wells and ultra-thin metallic films

Victor Barsan
Department of Theoretical Physics
IFIN-HH, Magurele-Bucharest, Romania

###### Abstract

The eigenvalue equations for the energy of bound states of a particle in a
square well are solved, and the exact solutions are obtained, as power series.
Accurate analytical approximate solutions are also given. The application of
these results in the physics of quantum wells are discussed,especially for
ultra-thin metallic films, but also in the case of resonant cavities,
heterojunction lasers, revivals and super-revivals.

##  1 Introduction

The present paper illustrates two interesting facts, namely: (1) some
important nanophysical systems, for instance quantum wells, can be understood
with elementary quantum mechanics [1]; and (2) elementary quantum mechanics
offers still unexplored domains, for instance the transcendental equations of
eigenenergy. In fact, in almost all ’exactly solvable problems’ of quantum
mechanics, only the Schroedinger equation for the wave functions has an exact
solution, but the transcendental equation for the eigenvalues can be solved
only numerically or graphically. The attempt of finding analytical - exact or
numerical - solutions for these equations is largely unexplored, even if it
might demand sometimes quite elementary mathematics. So, ’there is plenty of
room at the bottom’ - to use Feynman’s words in a different context. Inter
alia, in this article we shall undertake such an exercise - to obtain
analytical solutions for the eigenenergy of bound states of a particle in a
finite square well. Of course, the issue of the bound states of a square well
has a long history, being discussed in about 40 papers, in the last six
decades, to say nothing about textbooks; for a review, see [2].

Until the mid ’80s, the quantum square well was just a problem of elementary
quantum mechanics, with applications in obtaining the energy levels of quasi-
free electrons moving on long molecules or just below the free surface of a
metal [3], or in the elementary theory of the Ramsauer-Townsed effect [4]. The
odd parity states of the 1D square well are in the same time the $l=0$
solutions of the 3D problem of a particle moving in a ’radial square well’,
the so-called ’deuteron problem’, see for instance [5], vol.1, Problem 63,
p.162. A more subtle application refers to ultrathin conducting channels in
field-effect transistors [6].

How this elementary problem became really important? The impressive progress
of experimental physics in early ’80s made possible the fabrication of
heterostructures and quantum wells [7], and the fact that the general
principles of their physics can be easily understood, using the model of the
”particle in a rectangular box” has been immediately exploited. The basic fact
is that, in a very thin film, with planar surfaces, with mesoscopic or
macroscopic longitudinal dimensions, and with nanoscopic transversal
dimensions, the longitudinal momentum (or wave vector) of electrons is
quantized according to cyclic boundary conditions, generating quasi-continuous
values, and the transversal momentum (or wave vector) - according to rigid
boundary conditions, generating quantized values; the transversal quantum
number depends on the film thickness. The transversal motion of the electrons
can be described as a ’quantum square well problem’. Consequently, the
electron spectrum is split in subbands, indexed by the transversal quantum
numbers, with a quasi-continuous energy given by quasi-continous longitudinal
momentum. As the transversal momentum, which depends on film thickness, cannot
be larger than the Fermi momentum, there is a connection between the film
thickness and the Fermi momentum. Due to the fact that this connection
involves discontinous and continous functions, via the transverse and
longitudinal momenta, the physical quantities describing the system are
characterized by functions with discontinous derivatives, or even with
discontinuities. They produce an interesting physical behavior, namely quantum
size effects (QSEs)

In the last two decades, the ultra-thin metallic films where subject of
intense investigation, especially due just to such QSEs, observed in such
systems, consisting of an oscillatory behavior of the film stability [8], of
the lattice deformation [9], of the work function [10] etc., as a function of
the number of atomic monolayers. The QSEs, predicted in the pioneering papers
of Sandomirskii [11] and Schulte [12], are of considerable interest, from both
practical and theoretical points of view. Metallic ultra-thin films are
especially relevant for ferromagnetic materials, being responsible for the
giant magnetoresistivity observed in the antiferromagnetic superlattice [13].
Also, tuning the number of monolayers means, due to QSEs, tuning the work
function, consequently tuning the chemical properties of the surface [10].

This quite rich physics can be explained using a quite elementary formalism,
considering, as just mentioned, that the movement of electrons in a direction
transversal to the surface of the metallic film is quantized using the quantum
wells theory. Even the crude approximation of an infinite square well might be
still useful, for instance for the calculation of the lattice deformation [9]
or of the Fermi energy [14]. These successes can be easily understood, due to
the fact that, if the number of monolayers is not too small $\left(n\gtrsim
25\right)$, the role of deep levels is dominant, and the difference between
the deep levels of a finite well and the corresponding levels (i.e. having the
same quantum numbers) of the infinite well is negligible. However, if the
number of monolayers is of the order of unity $\left(n\lesssim 5\right),$ it
is more and more inappropriate to approximate the levels of the quantum wells,
i.e. the levels of electrons moving normal to the surface, with the levels of
an infinite well. This is why it is important to obtain the exact values of
the bound states for a well of an arbitrary depth, or reasonably precise
analytic approximations of these quantities.

The structure of this paper is the following. In Section 2, we expose the
elementary problem of the finite square well, discussing carefully the
eigenvalue problem; to find its solution means to obtain a set of functions,
$\xi_{n}$ and $\zeta_{n}$,corresponding to the even and odd parity states.
Section 3 is devoted to the so-called parabolic and cubic approximations for
these functions. In Section 4, we put the transcendental equation for the
energy eigenvalue in a differential form, and obtain an exact series expansion
for $\xi_{n}$ and $\zeta_{n}.$ The 3rd order approximation of this series -
the Barker’s approximation [15] \- is discussed in the light of the exact and
approximate solutions, as it is already used in several applications. In
Section 5 we discuss the applications of our results, in three domains: ultra-
thin metallic films, revivals and super-revivals, and electromagnetism.
Several concluding remarks are presented in Section 6.

##  2 The quantum square well

In this section, we shall present the quantum mechanical problem of a particle
in a finite square well. There are in principle two ways of defining the
potential of the well, namely taking the top of the well at $E=0,$ or taking
the bottom at $E=0.$ In the first case, the advantage is that the bound states
(situated ”inside the well”) have negative energy - the typical situation for
bound states, in quantum mechanics. In the second case, the advantage is that,
in the limit of a very deep well, the levels are close to the corresponding
levels (having the same quantum number) of the infinite well. We shall examine
in detail the first case, when the potential is:

$V\left(x\right)=-U\cdot\theta(\frac{a}{2}-\left|x\right|)\ $ (1)

and $\theta$ defines the Heaviside function. The second case is briefly
discussed later on, see Eqs. (32), (33). The Schroedinger equation for a
particle of mass $m$ moving in the potential (1) has the form:

$\left[-\frac{\hbar^{2}}{2m}\frac{d^{2}}{dx^{2}}+V\left(x\right)-E\right]\psi\left(x\right)=0\
$ (2)

As the potential is invariant to space inversion,
$V\left(x\right)=V\left(-x\right),$ the solutions have well-defined parity. If
we introduce the wave vectors $k,\ k_{0}$ via the relations:

$E=-\frac{\hbar^{2}\left(k_{0}^{2}-k^{2}\right)}{2m},\ \
U=\frac{\hbar^{2}k_{0}^{2}}{2m}\ $ (3)

and the dimensionless quantity $P,$ which characterizes both the particle and
the potential$:$

$P=k_{0}a/2=\sqrt{2mU}\frac{a}{2\hbar}\ ,\ \ p=\frac{1}{P}\ $ (4)

Also,

$\ \frac{U}{P^{2}}=2\frac{\hbar^{2}}{ma^{2}}\ $ (5)

With this notation, the energy of the particle takes the form:

$E=-U\left[1-\left(\frac{ka}{2P}\right)^{2}\right]\ $ (6)

The even solutions of (2) are:

$\psi_{+}\left(x;k\right)=A_{+}\left(k\right)\left[\theta(\frac{a}{2}-\left|x\right|)\cdot\cos
kx+\right.\ $ (7)

$\left.+\theta(\left|x\right|-\frac{a}{2})\cdot\cos ka\
\cdot\exp\left(\sqrt{k_{0}^{2}-k_{n}^{2}}\left(a/2-x\right)\right)\right]$

$\psi_{+}\left(-x\right)=\psi_{+}\left(x\right)$ (8)

and the odd ones:

$\psi_{-}\left(x;k\right)=A_{-}\left(k\right)\left[\theta(\frac{a}{2}-\left|x\right|)\cdot\sin
kx+\right.$ (9)

$\left.+\theta(\left|x\right|-\frac{a}{2})\cdot\sin ka\
\cdot\exp\left(\sqrt{k_{0}^{2}-k_{n}^{2}}\left(a/2-x\right)\right)\right]$

$\psi_{-}\left(-x\right)=-\psi_{-}\left(x\right)\ $ (10)

The explicit form of the normalization constants $A_{\pm}\left(k\right)$ in
(7), (9) can be found for instance in [5] and will be not given here.

The energy eigenvalue equations can be conveniently written in terms of the
wave vector $k$. For even states:

$\
\frac{\cos^{2}\left(ka/2\right)}{\left(ka/2\right)^{2}}=\frac{1}{P^{2}}=p^{2}\
\ $ (11)

and for odd states:

$\frac{\sin^{2}\left(ka/2\right)}{\left(ka/2\right)^{2}}=\frac{1}{P^{2}}\
=p^{2}\ $ (12)

With $k$ obtained from (11), (12), the eigenenergy is given by (6).

So, to solve the eigenvalue equations (11), (12) means to find the functions
$\zeta\left(p\right),\ \xi\left(p\right)$ which satisfy the relations:

$\frac{\sin\zeta\left(p\right)}{\zeta\left(p\right)}=\pm p,\ \
\frac{\cos\xi\left(p\right)}{\xi\left(p\right)}=\pm p\ \ $ (13)

In order to clearly define the alternation of signs in (13), we shall identify
the intervals of monotony of the functions $\sin x/x,\ \cos x/x.$ Of course,
the $x$ varaible used here and hereafter has nothing to do with the spatial
coordinate, enterng in the Schroedinger equation (1) and in its solutions.The
extremum points of the function $\cos x/x$ are given by the roots $r_{cn}$ of
the equation:

$\tan x=-\frac{1}{x}\ $ (14)

where $r_{cn}$ is the root closest to $\left(n-1\right)\pi:$

$r_{cn}=\left(n-1\right)\pi-\frac{\left(n-1\right)\pi}{\left(n-1\right)^{2}\pi^{2}-1}\
+\mathcal{O}\left(\frac{1}{n^{2}}\right)\ $ (15)

The extremum values of the function $\cos x/x$ are:

$M_{cn}=\frac{\left(-1\right)^{n+1}}{\left(n-1\right)\pi}+\mathcal{O}\left(\frac{1}{n^{2}}\right),\
\ n>1$ (16)

It is easy to see that the eigenvalue equations for the even states are:

$x\in\left(0,\frac{\pi}{2}\right):\ \frac{\cos x}{x}=p;\
x\equiv\xi_{1}\left(p\right)\ $ (17)

$x\in\left(r_{c2}\simeq\pi,\frac{3\pi}{2}\right):\ \frac{\cos x}{x}=-p;\
x\equiv\xi_{2}\left(p\right)$ (18)

$x\in\left(r_{c3}\simeq 2\pi,\frac{5\pi}{2}\right):\ \frac{\cos x}{x}=p;\
x\equiv\xi_{3}\left(p\right)\ $ (19)

and so on.

Similarly, the extremum points of the function $\sin x/x$ are located in the
roots $r_{sn}$ of the equation:

$\tan x=x\ $ (20)

where $r_{sn}$ is the root closest to $\left(n-\frac{1}{2}\right)\pi.$ The
analogous of (15) is:

$r_{sn}=\left(n-\frac{1}{2}\right)\pi-\frac{1}{\left(n-\frac{1}{2}\right)\pi}+\
\mathcal{O}\left(\frac{1}{n^{2}}\right)\ $ (21)

The extremum values of the function $\sin x/x$ are:

$M_{s1}=1;\
M_{sn}=\frac{\left(-1\right)^{n-1}}{\left(n-\frac{1}{2}\right)\pi}+\mathcal{O}\left(\frac{1}{n^{2}}\right),\
n>1$ (22)

The eigenvalue equations for odd states are:

$x\in\left(0,\pi\right):\ \frac{\sin x}{x}=p;\ x\equiv\zeta_{1}\left(p\right)\
$ (23)

$x\in\left(r_{s,2}\simeq\frac{3}{2}\pi,2\pi\right):\ \frac{\sin x}{x}=-p;\
x\equiv\zeta_{2}\left(p\right)\ $ (24)

$x\in\left(r_{s,3}\simeq\frac{5}{2}\pi,3\pi\right):\ \frac{\sin x}{x}=p;\
x\equiv\zeta_{3}\left(p\right)\ $ (25)

and so on. Each of the Eqs. (17) - (19), (23) - (25) has a unique solution,
$\xi_{1}\left(p\right),\ \xi_{2}\left(p\right),\ \xi_{3}\left(p\right),$
respectively $\zeta_{1}\left(p\right),\ \ \zeta_{2}\left(p\right),\
\zeta_{3}\left(p\right),$ for sufficiently small values of $p.\ $On the
aforementioned intervals, the functions $\cos x/x,\ \sin x/x$ are monotonous,
and for their restriction on each of these intervals, an inverse function
exists. These inverse functions are, in the aforementioned cases,
$\xi_{1}\left(p\right),\ \xi_{2}\left(p\right),\ \xi_{3}\left(p\right),$
respectively $\zeta_{1}\left(p\right),$ $\ \zeta_{2}\left(p\right),\
\zeta_{3}\left(p\right).$ Their plots can be obtained as symmetric of the
restrictions of the functions $\cos x/x,\ \sin x/x$ on their intervals of
monotony, given by Eqs. (17) - (19), (23) - (25).

Graphically, the functions $\zeta\left(p\right),\ \xi\left(p\right)\
$correspond to the intersections of the $x-$coordinates of the plots of the
functions $\sin x/x,\ \cos x/x$ with the line $y=\pm p$, on well defined
intervals. The number of solutions depends on the value of $p.$ There is
always at least one solution $\xi\left(p\right)$ for any value of $p$, but the
solutions $\zeta\left(p\right)$ exist only for $p<1.$ In Fig.1, the plots of
the functions $\sin x/x$ (plain),$\ \cos x/x$ (dashed) and $y=\pm p,$ with
$p=0.1,$ are given. The $x-$coordinate of the intersection point of $\sin
x/x,\ $with $y=p,$ for $0<x<\pi,$ defines the function
$\zeta_{1}\left(p\right);$ with $y=-p$, for
$r_{s,2}\simeq\frac{3}{2}\pi<x<2\pi\,$, the function
$\zeta_{2}\left(p\right)$; with $y=p,$ for
$r_{s,3}\simeq\frac{5}{2}\pi<x<3\pi,$ the function $\zeta_{3}\left(p\right),$
etc. Similarly, the $x-$coordinate of the intersection point of $\cos x/x,\
$with $y=p,$ for $0<x<\pi/2,$ defines the function $\xi_{1}\left(p\right);$
with $y=-p$, for $r_{c2}\simeq\pi<x<\frac{3\pi}{2}\,$, the function
$\xi_{2}\left(p\right)$ etc.

As already mentioned, a finite well only supports a fixed number of bound
states. According to several authors (see for instance [16]), this number is
given by:

$n_{\max}=int\left(\frac{P}{\pi/2}\right)+1\ $ (26)

In other words, if we define:

$p\left(N\right)=\frac{2}{\left(N-1\right)\pi}\ $ (27)

for $p=p\left(N\right)-0^{+},$ the well supports $N-1$ bound states, and for
$p=p\left(N\right)+0^{+},$ it supports $N$ bound states. This statement is
correct in the approximation

$r_{cn}=\left(n-1\right)\pi,\ \ \ r_{sn}=\left(n-\frac{1}{2}\right)\pi\ $ (28)

i.e. when we identify the extremum points of the functions $\cos x/x,\ \sin
x/x$ with those of the functions $\cos x,\ \sin x.$ Rigorously speaking, the
situation is slightly more complicated, in the following sense. If $p$
decreases from $\left|M_{cn}\right|+0^{+}$ to $\left|M_{cn}\right|-0^{+},$ a
new root, namely $\xi_{n}$ shows up, and this corresponds to the
$\left(2n-1\right)$-th bound state. Similarly, if $p$ decreases from
$\left|M_{sn}\right|+0^{+}$ to $\left|M_{sn}\right|-0^{+},$ a new root, namely
$\zeta_{n}$ shows up, and this corresponds to the $2n$-th bound state.

Figure 1: The $x-$coordonate of the intersection of the functions $\sin x/x$
(solid) and $\cos x/x$ (dotted) with the lines $y=p$ and $y=-p\,$, according
to Eqs. (23) - (25) and (17) - (19), defines the functions
$\zeta_{n}\left(p\right)$ and $\xi_{n}\left(p\right),$ respectively.

The $n-$dependence of the coordinates of extremum points, $r_{cn},\ r_{sn}$,
has been obtained by approximating the $\tan$ function in (14), (21) with the
first term of its Taylor series expansion. An alternative way of finding
analytic approximations for the roots $r_{cn},\ r_{sn}$ is to use the
algebraic approximation for $\tan x,$ indicated in [17]. Of course, this is
only an example of the usefulness of this algebraic approximation formula,
which can be also used, for instance, to solve the eigenvalue equation for a
particle moving in an infinite rectangular well, with a $\delta-$function
barrier in the middle; indeed, this equation has the form $\tan z=-z/z_{0}$
[17].

According to Eq. (6), the eigenvalues of the energy are:

$E_{n}=-U+U\left(\frac{k_{n}a}{2P}\right)^{2},\ \ n\geqslant 1\ $ (29)

If we consider a particle which is moving not in the potential
$V\left(x\right)$ given by (1), but in a potential

$V^{\left(1\right)}\left(x\right)=V\left(x\right)+U\ $ (30)

then the energy levels will be given by:

$E_{n}^{\left(1\right)}=U\left(\frac{k_{n}a}{2P}\right)^{2}=2\frac{\hbar^{2}}{ma^{2}}\left(\frac{k_{n}a}{2}\right)^{2},\
\ n\geqslant 1\ $ (31)

In correspondence to the parity of $n,$ $k_{n}a/2$ corresponds to the
functions $\xi$ or $\zeta,$ for instance $k_{1}a/2=\xi_{1}\left(p\right),\
k_{2}a/2=\zeta_{1}\left(p\right),$ etc. In general,

$E_{2n-1}^{\left(1\right)}=2\frac{\hbar^{2}}{ma^{2}}\xi_{n}^{2},\ \
E_{2n}^{\left(1\right)}=2\frac{\hbar^{2}}{ma^{2}}\zeta_{n}^{2},\ \ n\geqslant
1\ $ (32)

Let us remind that the quantity $k_{0}$ defined in (3) cannot be obtained
putting $n=0$ in (29), (31), (32).

So, the eigenfunctions for the even states are:

$\psi_{2n-1}\left(x\right)=\psi_{+}\left(x;k_{2n-1}\right)=\psi_{+}\left(x;\frac{2}{a}\xi_{n}\right),\
\ n\geqslant 1\ $ (33)

and for the odd states:

$\psi_{2n}\left(x\right)=\psi_{-}\left(x;k_{2n}\right)=\psi_{+}\left(x;\frac{2}{a}\zeta_{n}\right),\
\ n\geqslant 1\ $ (34)

As it has been already mentioned, the advantage of using the potential (1)
consists in the fact that the energies of the particle ”inside the well”, i.e.
the energy of the bound states, are negative, which corresponds to the usual
convention adopted in quantum mechanics. However, the form (30) of the
potential has the advantage - also mentioned previously - that its levels
become, in the limit of a very deep well, the levels of the infinite well. It
is indeed easy to see that, for $n\rightarrow\infty,$ so for very deep wells,
the quantization condition for the wave vector becomes $k_{n}a\simeq n\pi,$ so

$k_{n}\simeq\frac{n\pi}{a}\ $ (35)

and the Eq. (31) becomes the equation of the energy levels of an infinite
well:

$E_{n}^{\left(\infty\right)}=\frac{\pi^{2}\hbar^{2}}{2ma^{2}}n^{2}\ $ (36)

##  3 The parabolic and cubic approximations

The parabolic and cubic approximations consist in approximating the
restrictions of the functions $\cos x/x,\ \sin x/x$ on their monotony
intervals, defined in Section 2, with segments of parabolas, or of cubic
polynomials, having the same roots, extremum points and (in the case of cubic
polynomials) slope in the root, as the exact functions. The detailed methods
for obtaining these approximations have been indicated in [18], [2]. We shall
give here only the results. The parabolic approximation for the functions
$\xi,\ \zeta$ is:

$\xi_{n}^{\left(ip\right)}\left(x\right)=r_{cn}+\left(\left(n-\frac{1}{2}\right)\pi-
r_{cn}\right)\sqrt{1-\frac{x}{M_{cn}}},\ n>1\ $ (37)

Also,

$\zeta_{n}^{\left(ip\right)}\left(x\right)\ =r_{sn}+\left(n\pi-
r_{sn}\right)\sqrt{1-\frac{x}{M_{sn}}}\ ,\ n>1$ (38)

They are defined on the intervals $\left(M_{\alpha n},0\right)$ for $n=even$
and on $\left(0,M_{\alpha n}\right),$ for $n=odd,$ with $\alpha=c$ for $\xi$
functions and $\alpha=s$ for $\zeta$ functions.

If the extremum points of the functions $\cos x/x,\ \sin x/x$ are approximated
with the extremum points of the functions $\ \cos x,\ \sin x,\ $the formulas
(37), (38) become:

$\xi_{n}^{\left(sp\right)}\left(x\right)=\left(n-1\right)\pi+\sqrt{\frac{\pi^{2}}{4}-\frac{x}{4}\left(n-1\right)\pi^{3}}\
\ $ (39)

$\zeta_{n}^{\left(sp\right)}\left(x\right)=\left(n-\frac{1}{2}\right)\pi+\sqrt{\frac{\pi^{2}}{4}+\frac{x}{4}\left(n-\frac{1}{2}\right)\pi^{3}}\
$ (40)

and their intervals of definition change accordingly. As the formulas (39),
(40) are sometimes referred to as ’simple parabolic approximation’, we shall
refer to (37), (38) as ’improved parabolic approximation’. This convention
explains the upper indices in the definition of $\xi_{n}$ and $\zeta_{n}$
functions, Eqs. (37), (38) and (39), (40).

In order to introduce the cubic approximations for the functions $\xi,\
\zeta,$ we have to define the quantities:

$X_{sn,M}=r_{s,n}-n\pi\ ,\ \ \ \ a_{sn,1}=\frac{\left(-1\right)^{n}}{n\pi}\ $
(41)

and

$a_{sn,3}=-\frac{2M_{sn}}{X_{sn,M}^{3}}+\frac{a_{sn,1}}{X_{sn,M}^{2}},\ \ \
a_{sn,2}=\frac{3M_{sn}}{X_{sn,M}^{2}}-\frac{2a_{sn,1}}{X_{sn,M}}\ $ (42)

Using the notations:

$A_{sn,1}=\frac{a_{sn,1}}{a_{sn,3}}-\frac{1}{3}\frac{a_{sn,2}^{2}}{a_{sn,3}^{2}}<0;\
\
A_{sn,0}\left(x\right)=\frac{2}{27}\frac{a_{sn,2}^{3}}{a_{sn,3}^{3}}-\frac{1}{3}\frac{a_{sn,1}a_{sn,2}}{a_{sn,3}^{2}}-\frac{x}{a_{sn,3}}\
$ (43)

the cubic approximation for $\zeta_{n}\left(x\right)$ is:

$\zeta_{n}^{\left(c\right)}\left(x\right)=n\pi-\frac{a_{sn,2}}{3a_{sn,3}}+\frac{2\left|A_{sn,1}\right|^{1/2}}{\sqrt{3}}\sin\left(\frac{1}{3}\arcsin\left(\frac{\sqrt{27}}{2}\frac{A_{sn,0}\left(x\right)}{\left|A_{sn,1}\right|^{3/2}}\right)\right)\
$ (44)

Similarly, defining:

$X_{cn}=x-\left(n-\frac{1}{2}\right)\pi,\ \ \
a_{cn,1}=\frac{\left(-1\right)^{n}}{\left(n-\frac{1}{2}\right)\pi}$ (45)

and simply replacing the index $s$ by $c$ in (42), (43), we get the cubic
approximation for $\xi_{n}\left(x\right).$

$\xi_{n}^{\left(c\right)}\left(x\right)=\left(n-\frac{1}{2}\right)\pi-\frac{a_{cn,2}}{3a_{cn,3}}+\frac{2}{\sqrt{3}}\left|A_{cn,1}\right|^{1/2}\sin\left(\frac{1}{3}\arcsin\left(\frac{\sqrt{27}}{2}\frac{A_{cn,0}\left(x\right)}{\left|A_{cn,1}\right|^{3/2}}\right)\right)\
$ (46)

The cubic approximations are defined on the same intervals as the
corresponding parabolic approximations.

As $\cos x/x$, for $0<x<\pi/2$ cannot be approximated by a polynomial, the
root $\xi_{1}$ cannot be obtained from the formulas (37) or (46). The function
$\sin x/x$ for $0<x<\pi$ can be approximated by a polynomial, but cannot be
obtained from the general formulas, as the interval of monotony is not of the
form used for the evaluation of $\zeta_{n},$ with $n>1.$ However, the same
approach can be used, giving:

$\zeta_{1}^{\left(p\right)}\left(x\right)=\pi\sqrt{1-x}\ $ (47)

for the parabolic approximation (in this case, the simple and the improved
approximation coincide), and

$\zeta_{1}^{\left(c\right)}\left(x\right)=\frac{\pi\left(1-x\right)^{1/2}}{2^{1/2}}\cdot\
$ (48)

$\cdot\frac{1}{-\frac{1}{\sqrt{3}}\sin\left(\frac{1}{3}\arcsin\left(\frac{3^{3/2}}{2^{5/2}}\left(1-x\right)^{1/2}\right)\right)+\cos\left(\frac{1}{3}\arcsin\left(\frac{3^{3/2}}{2^{5/2}}\left(1-x\right)^{1/2}\right)\right)}$

for the cubic approximation.

Some caution is needed while switching from $x$ to $p$ dependence in these
formulas. In fact, the parabolic and cubic approximations have been obtained
in a pure geometric context, and the functions $\xi_{n}\left(p\right),\
\zeta_{n}\left(p\right)$ in (29), (32) - in a dynamic context, so, in order to
use these approximations in the eigenvalue expressions, we have to write
$\xi_{n}^{\left(c\right)}\left(p\right)\equiv\xi_{n}^{\left(c\right)}\left(\left|x\right|\rightarrow
p\right),\
\zeta_{n}^{\left(c\right)}\left(p\right)\equiv\zeta_{n}^{\left(c\right)}\left(\left|x\right|\rightarrow
p\right).$ The expressions of the cubic approximations for the functions
indexed by $n=2...4$ are given in the Appendix.

##  4 The differential form of the transcendental equations

We shall expose now a method of solving the eigenvalue equations, discovered
and re-discovered several times, which generates an exact solution, in the
form of a series expansion. As we shall see, the method works for a large
class of transcendental equations.

Let us take the derivatives in both sides of the equations (17)-(19) and
(23)-(25), putting:

$X_{2n}\left(p\right)=\zeta_{n}\left(p\right),X_{2n-1}\left(p\right)=\xi_{n}\left(p\right),\
n=1,2,...,\ \ \ $ (49)

replacing $p$ by $x$ and relaxing the restriction $p>0.$ The equations for the
energy eigenvalues can be written in a unitary form:

$\frac{dX_{n}\left(x\right)}{dx}=-\frac{X_{n}\left(x\right)}{\sqrt{1-x^{2}X_{n}\left(x\right)^{2}}+x}\
$ (50)

with the initial condition:

$X_{n}(0)=\frac{n\pi}{2}$ (51)

It is remarkable that both the even, and the odd solutions, satisfy identical
differential equations.The formula (50) allows us to obtain the derivatives of
any order of $X_{n}\left(x\right)$ in an arbitrary point $x_{0}$ and,
consequently, to construct the Taylor series for this function, with arbitrary
precision. Choosing $x_{0}=0$, and putting:

$\frac{X_{n}\left(x\right)}{X_{n}\left(0\right)}=\frac{X_{n}\left(x\right)}{n\pi/2}=x_{n}\left(x\right)=\sum_{m=0}^{\infty}q_{m}\left(\frac{n\pi}{2}\right)x^{m}\
$ (52)

we get the following exact series expansion for $x_{n}\left(x\right):$

$x_{n}\left(x\right)=\sum_{m=0}^{\infty}q_{m}\left(\frac{n\pi}{2}\right)x^{m}\
$ (53)

The first 6 functions $q_{m}$ are the following polynomials in the variable

$\frac{n\pi}{2}\equiv b_{n},$ (54)

namely

$q_{0}\left(b_{n}\right)=1,\ \ q_{1}\left(b_{n}\right)=-1,\ \
q_{2}\left(b_{n}\right)=1\ $ (55)

$q_{3}\left(b_{n}\right)=-\left(1+\frac{b_{n}^{2}}{6}\right),\ \
q_{4}\left(b_{n}\right)=\left(1+\frac{2b_{n}^{2}}{3}\right)\ $ (56)

$q_{5}\left(b_{n}\right)=-\left(1+\frac{5}{3}b_{n}^{2}+\frac{3}{2^{3}\cdot
5}b_{n}^{4}\right),\ \ q_{6}\left(b_{n}\right)=\left(1+\frac{2\cdot
5}{3}b_{n}^{2}+\frac{2^{3}}{3\cdot 5}b_{n}^{4}\right)\ $ (57)

The polynomials $q_{2n-1}\left(b\right),\ q_{2n}\left(b\right)$ have the same
order, $2n-1.$ We calculated quite a lot of such polynomials (see the
Appendix) with the expectation that this exercise could help to guess a
general formula for its coefficients. However, the presence of some large
prime numbers in the products which enter in the coefficient of polynomials
$q_{m}$, specially for odd indices, is somewhat discouraging for the attempt
of finding general expressions for this quantities.

The limit $p\rightarrow 0$ corresponds to the infinite well. It is easy to
see, using (35) and (53), that:

$E_{n}^{\left(1\right)}\left(p\right)=E_{n}^{\left(\infty\right)}\cdot
x_{n}^{2}\left(x\right)\ $ (58)

with

$E_{n}^{\left(\infty\right)}=2\frac{\hbar^{2}}{ma^{2}}X_{n}^{2}\left(0\right)\
$ (59)

Also, the energy levels of the semi-infinite well, corresponding to the limit
$\,U_{0}\rightarrow\infty$ in (30), are given by:

$E_{n}^{\left(s\infty\right)}=\frac{2\hbar^{2}X_{2n-1}\left(0\right)^{2}}{ma^{2}}=\frac{2\hbar^{2}\pi^{2}}{ma^{2}}\left(n-\frac{1}{2}\right)^{2}\
$ (60)

Numerical studies show that the series expansion (53) can be used only in a
small interval near the origin; its value in another point must be obtained
constructing the series expansion near that point. This is why, for practical
calculations, it is convenient to use various approximations of the exact
formula.

Restricting the series (53) at its first 3 terms, we get Barker’s
approximation [15]:

$X_{n}^{\left(B\right)}\left(p\right)=\frac{n\pi}{2}\left(1-p+p^{2}-\left(1+\frac{1}{6}\left(\frac{n\pi}{2}\right)^{2}p^{3}\right)\right)\
$ (61)

Barker’s approximation has been used in several applications of the square
well, for instance in the study of revivals and super-revivals. As given by
its author, the approximation formula is:

$\alpha_{n}\left(p\right)=\frac{1}{1+p}\frac{n\pi}{2}-\frac{p^{3}}{6\left(1+p\right)^{6}}\left(\frac{n\pi}{2}\right)^{3}=$

$=\allowbreak\frac{1}{2}\pi n-\frac{1}{2}\pi np+\frac{1}{2}\pi
np^{2}-\frac{1}{2}\pi n\left(1+\frac{1}{24}\pi^{2}n^{2}\right)p^{3}+...\ $
(62)

With our notations,

$\alpha_{n}\left(p\right)=X_{n}^{\left(B\right)}\left(p\right)\ $ (63)

As Barker’s approximation is a consequence of the cubic approximation of the
$\sin$ function, its precision goes up to the third order terms, so the terms
not explicitly written in the r.h.s. of (62) must be omitted. In other words,
the correct form of the ”Barker’s approximation” is the polynomial form given
in (61), not the fractional form given in the original paper. We can check
this property verifying that

$\frac{\sin\left(\zeta_{1}^{\left(B\right)}\left(p\right)\right)}{\zeta_{1}^{\left(B\right)}\left(p\right)}=p+\mathcal{O}\left(p^{4}\right),\
\
\frac{\sin\left(\zeta_{2}^{\left(B\right)}\left(p\right)\right)}{\zeta_{2}^{\left(B\right)}\left(p\right)}=-p+\mathcal{O}\left(p^{4}\right)$

and so on. Such a property has any polynomial approximation of the exact
solution. For instance, putting:

$\zeta_{n}^{\left(N\right)}\left(p\right)=X_{2n}^{\left(N\right)}\left(p\right)=n\pi\sum_{m=0}^{N}q_{m}\left(n\pi\right)p^{m}$

we get:

$\frac{\sin\left(\zeta_{n}^{\left(N\right)}\left(p\right)\right)}{\zeta_{n}^{\left(N\right)}\left(p\right)}=\left(-1\right)^{n+1}p+\mathcal{O}\left(p^{N+1}\right)$

Graphical and numerical considerations show that Barker’s approximation cannot
be used for $\xi_{1}$ and $\zeta_{1},$ but is useful for any other case, being
more precise for smaller values of $p.$ The parabolic approximation can be
used, qualitatively, for $\zeta_{1},$ but is less precise than Barker’s one,
in all other cases. The cubic approximation gives excellent results in all
cases, excepting $\xi_{1},$ where de Alcantara Bonfim - Griffith solution
should be used. Polynomial approximations of the exact solutions, higher than
Barker’s, are useful only for small arguments, so Barker’s approximation can
be considered as the most convenient polynomial approximation. For the
illustration of these conclusions, we give here the plots for the $\zeta_{1}$
and $\zeta_{2}$ functions.

In Fig. 2, we can see how accurately the solutions
$\zeta_{1}^{\left(B\right)},\ \zeta_{1}^{\left(sp\right)}$ and
$\zeta_{1}^{\left(c\right)}$ satisfy the equation (23). The functions

$\frac{\sin\left(\zeta_{1}^{\left(B\right)}\left(p\right)\right)}{\zeta_{1}^{\left(B\right)}\left(p\right)},\
\frac{\sin\left(\zeta_{1}^{\left(sp\right)}\left(p\right)\right)}{\zeta_{1}^{\left(sp\right)}\left(p\right)},\
\frac{\sin\left(\zeta_{1}^{\left(c\right)}\left(p\right)\right)}{\zeta_{1}^{\left(c\right)}\left(p\right)}$

are plotted with solid black, solid green and dotted black lines,
respectively; the function $f_{1}\left(p\right)=p$ \- with red. Barker’s
approximation is unusable, the parabolic one - quite poor, and the cubic one
\- very good. In Fig. 3, we check, similarly, how accurately the solutions
$\zeta_{2}^{\left(B\right)},\ \zeta_{2}^{\left(sp\right)}$ and
$\zeta_{2}^{\left(c\right)}$ satisfy the equation (24); the conventions are
similar, excepting the fact that instead of the function $f_{1},$ the function
$f_{2}\left(p\right)=-p$ is plotted. Now, the Barker approximation is
reasonably correct, especially for small values of the argument, the parabolic
one is poorer than Barker’s, and the cubic one is very accurate. These
conclusions remain valid for the higher orders of both $\zeta$ and $\xi$
functions, with the remark that, in general, Barker’s approximations becomes
quite poor for large values of the argument.

Figure 2: The functions
$\frac{\sin\left(\zeta_{1}^{\left(B\right)}\left(p\right)\right)}{\zeta_{1}^{\left(B\right)}\left(p\right)}$
(solid, black)$,\
\frac{\sin\left(\zeta_{1}^{\left(sp\right)}\left(p\right)\right)}{\zeta_{1}^{\left(sp\right)}\left(p\right)}$
(solid, green)$,\
\frac{\sin\left(\zeta_{1}^{\left(c\right)}\left(p\right)\right)}{\zeta_{1}^{\left(c\right)}\left(p\right)}$
(dotted, black) and $f_{1}\left(p\right)=p$ (solid, red). Figure 3: The
functions
$\frac{\sin\left(\zeta_{2}^{\left(B\right)}\left(p\right)\right)}{\zeta_{2}^{\left(B\right)}\left(p\right)}$
(solid, black)$,\
\frac{\sin\left(\zeta_{2}^{\left(sp\right)}\left(p\right)\right)}{\zeta_{2}^{\left(sp\right)}\left(p\right)}$
(solid, green)$,\
\frac{\sin\left(\zeta_{2}^{\left(c\right)}\left(p\right)\right)}{\zeta_{2}^{\left(c\right)}\left(p\right)}$
(dotted, black) and $f_{2}\left(p\right)=-p$ (solid, red).

Maybe because the rectangular well is, from the point of view of advanced
physics, an elementary problem (even if, from the mathematical point of view,
the eigenvalue equations for the energy are not at all trivial), it is
sometimes underestimated, and several results obtained by various authors
remained unnoticed, and re-obtained in other forms; so, the domain has many
repetitions and overlappings. For instance, in [19], the authors use the same
method as that just exposed here in order to find a series expansion for the
solutions of the eigenvalue equations, but the expansion used by them,
equivalent to (65), is limited to second order terms. In fact, the precision
of their research, which is focused on the physical properties of a mesoscopic
film of thickness $L_{z}$, does not request a better precision. However, this
precision is inferior to the precision of the Barker approximation which, as
we could see, goes to third order terms. Apparently, it seems that in [19]
Barker’s results are ignored, and re-obtain the series using a different
method.

Also, in spite of the fact that the equivalence of the Sturm - Liouville
problems for electromagnetic waves and wave functions is well known since the
early years of the quantum mechanics, the results obtained in the square well
problem seem to remain unused by the researchers studying light propagation in
waveguides or in other simple geometries. Reciprocally, the very detailed
analysis of the eigenvalue equations, very similar to that of a square well,
used in the propagation of electromagnetic waves [20], where a number of
approximate solutions have been proposed (see for instance the references [90,
92] in [20]), seem to have remained unnoticed by people working in quantum
mechanics.

##  5 Applications: ultrathin metallic films, revivals and electromagnetism

###  5.1 Ultra-thin metallic films

Even if the infinite square well is a very crude model, it can explain
satisfactorily many aspects of the physics of metallic thin films. This is not
very surprising, as the energy levels of a deep square well are acceptably
approximated, for large quantum numbers, by the levels of an infinite well.
The approximation fails for the first ones $\left(n\lesssim 5\right),$ but for
a film with $n\gtrsim$ 25 monolayers, the effect is not dramatic. The infinite
well model has been improved, taking into account, in an approximative manner,
the fact that the electron moving in the well can penetrate its walls; this is
the so-called phase accumulation model (PAM). The model is exposed in a number
of papers, [21], [22], [13]; concerning PAM for a metal - semiconductor
interface, see [23]. However, even PAM gives very inaccurate results for very
thin films. The fact that both the infinite well model and PAM are
inappropriate for shallow wells (for instance, in an 1 ML Ag film, only a
single QW state exists [22]) is discussed by several researchers. For
instance, in [8], the authors warn about the fact that we have to be very
cautious when we apply the infinite well model to very thin films; in fact,
they find that the stability of a thin film of less than 5 monolayers depends
sensitively on the height of interface energy barriers, (see [8], p.6). In the
photoemission studies of QW states in thin films, reported in [24] and [25],
the data for the first 3 monolayers are excluded from the fit, in a PAM
analysis. The angle - resolved photoemission is indeed an important tool for
the study of electron states in QWs. In fact, there is a close analogy between
a standing electromagnetic wave propagating between two reflecting surfaces
and an electron moving in a square potential well [26]. The first case
corresponds to the Fabry - Perot interferometer, which shows a set of peaks in
optical transmission; the second, to an electron confined in QW, formed in an
ultra-thin metallic film. Electron confinement within a film results in
discrete QW states, observable by angle-resolved photoemission. For a such
film of Ag on Fe, angle-resolved photoemission spectra are well explained by
PAM for number of ML ¿2, but fails for 1 or 2 monolayers. [27].

So, the exact treatment of the finite well, or analytic approximations of the
exact solutions are necessary for a correct description of the shallow wells
(presuming that the model itself is still usable in all ultra-thin films). Our
results can be directly used in the approach of Wu and Zhang [8] who apply the
finite well model to the study of very thin films, but use numerical instead
of analytical solutions. For freestanding films, where the electrons move in a
symmetric square well of barrier height

$V_{0}=W_{m}+E_{F}\ $ (64)

the theory works without any adjustable parameter. The freestanding films are
of great theoretical interest, as they can serve as reference points to see
how substrates affect film properties.

For a film on a semiconductor substrate, the film is modeled as electrons
residing in an asymmetric well, so:

$V\left(x<\left|a\right|/2\right)=V_{1}=W_{m1}+E_{F},\ \ \ \
V\left(x>\left|a\right|/2\right)=V_{2}=W_{m2}+E_{F}\ $ (65)

As $W_{m1},\ W_{m1}\ $are comparable, $\left|V_{1}-V_{2}\right|\ll V_{1},\
V_{2},$ and the eigenenergy can be obtained using the perturbation theory,
considering the symmetric well as exactly solvable problem. The same remarks
applies for an electron in a corrugated box, for instance if the corrugated
periodic potential is ([8], eq. (29)):

$V_{c}\left(z\right)=v\cos\frac{2\pi z}{d_{0}}\ $ (66)

with $\nu\ll V_{0}.$

For solid-solid and solid-vacuum interfaces, the confinement potential is
generally finite and rounded. Examples of such potentials, for multilayered
nanostructures, obtained using the dynamical mean-field theory approach, can
be found in [28], Sect. 3.6. If this more realistic form of the potential has
to be taken into account, its eigenstates can be obtained by simple
perturbation calculation, from the eigenstates of the rectangular well.

It is well known that the Sturm - Liouville problems in optics and quantum
mechanics can be identical [29], [30], so the quantized values of the wave
vector of the quantum mechanical problem correspond perfectly to the normal
modes of transversal electric field in resonant cavities, wave guides or
heterostructure lasers, so our solutions of the energy eigenvalues can be
applied also in optics and electromagnetism.

###  5.2 Revivals

As it is well known, wave packets in infinite square wells produce revivals,
and in finite square wells - both revivals and super-revivals. Analyzing
numerically the superrevivals in finite square wells, [31] notices that the
Barker’s formula:

$E_{n}\simeq\frac{P^{2}}{\left(P+1\right)^{2}}\frac{\pi^{2}\hbar^{2}}{2mL^{2}}n^{2}\
$ (67)

(actually, the first term of the Barker’s formula, obtained in fact by Garrett
[32]) is less precise for shallow wells, than for deep wells. This property
clearly results from our analysis of exact and approximate solutions of the
square well problem. The same approximation is used by [33] However, no
analytic result can be obtained in this way, as the $n-$dependence of the
eigenenergy is qualitatively different in the two cases (for the finite square
well, the simple $n^{2}$ dependence disappears), and this difference is
smeared out in the Barker approximation.

The solutions of the transcendental equations allows us to find the analytic
expressions of the revivals and superrevivals times for the finite square
well, according to the Eqs. (10), (26-28) of [16].

###  5.3 Electromagnetism

The electromagnetic wave propagation in the symmetric three-layer slab
waveguide is an example of phenomena described by a Sturm - Liouville system
essentially identical to that of the quantum square well. Due to the large
number of quantities to be defined in order to follow in detail the similarity
of the two phenomena, we shall omit a detailed presentation, mentioning only
that the equations giving the propagation constant (the wave vector) of the
even and odd transversal electric modes, and of the even and odd transversal
magnetic modes, respectively (2.4-45), (2.4-54); (2.4-60), (2.4-66) in [34]
correspond exactly to the eigenvalue equations for the energy of even and odd
bound states in a quantum square well, respectively Eqs. (25.4e) and (25.4o)
of [5].

##  6 Conclusions

This paper represents an illustration of the situation when solutions of
simple problems of quantum mechanics can be used for description of
interesting phenomena in nanophysics. Specifically, we have referred to exact
solutions of the eigenvalue equations for the energy of bound states of a
particle in a rectangular well. Even if the physics of this problem is
elementary, its mathematics is not trivial, and consists in solving a
transcendental equation. Both exact and approximate solutions are obtained,
with various degrees of accuracy. The results are interesting for the physics
of quantum wells, mainly for the important case of ultra-thin metallic films.
Besides the case of electrons in rectangular quantum wells, the case of rugose
bottom wells can be treated, with an elementary perturbation theory. Also, the
theory described here has applications in the domain of heterojunction lasers
and in the electromagnetic wave propagation in three slab dielectric
waveguides.

##  Appendix A Appendix

The function $\xi_{1}$ cannot be obtained using the polynomial approximations
described in Section 3. Very accurate analytical approximations for $\xi_{1}$
(with an error of about $10^{-3}$) have been proposed by de Alcantara Bonfim
and Griffith [17], using an algebraic approximations for the $\cos$ function.

The cubic approximation for the following 4 $\xi_{n}$ functions is:

$\xi_{2}^{\left(c\right)}\left(p\right)=4.2409+2.8851\sin\left(\frac{1}{3}\arcsin\left(0.4728-4.3767p\right)\right)\
$ (A1)

$\xi_{3}^{\left(c\right)}\left(p\right)=7.6132+2.9840\sin\left(\frac{1}{3}\arcsin\left(0.2300-7.6906p\right)\right)\
$ (A2)

$\xi_{4}^{\left(c\right)}\left(p\right)=10.8580+3.0803\sin\left(\frac{1}{3}\arcsin\left(0.1336-10.6235p\right)\right)\
$ (A3)

$\xi_{5}^{\left(c\right)}\left(p\right)=14.0607+3.1484\sin\left(\frac{1}{3}\arcsin\left(0.0729-13.439p\right)\right)\
$ (A4)

The cubic approximation for $\zeta_{1}$ is given in Section 3. The next four
$\zeta_{n}$ functions are:

$\zeta_{2}^{\left(c\right)}\left(p\right)=5.9562+2.9256\sin\left(\frac{1}{3}\arcsin\left(0.3297-6.121p\right)\right)$
(A5)

$\zeta_{3}^{\left(c\right)}\left(p\right)=9.24337+3.03623\sin\left(\frac{1}{3}\arcsin\left(0.178\,39-9.\,\allowbreak
179\,3p\right)\right)$ (A6)

$\zeta_{4}^{\left(c\right)}\left(p\right)=12.4627+3.1173\sin\left(\frac{1}{3}\arcsin\left(0.0996-12.0402p\right)\right)\
$ (A7)

$\zeta_{5}^{\left(c\right)}\left(p\right)=15.6911+3.2908\sin\left(\frac{1}{3}\arcsin\left(0.01538-14.3186p\right)\right)$
(A8)

The coefficients $q_{7},...q_{16},$ of the exact series expansion (53)

$q_{7}\left(b\right)=-\left(1+\frac{5\cdot 7}{2\cdot 3}b^{2}+\frac{7\cdot
37}{2^{3}\cdot 3\cdot 5}b^{4}+\frac{5}{2^{7}\cdot 7}b^{6}\right)\ $ (A9)

$q_{8}\left(b\right)=\left(1+\frac{2^{2}\cdot 7}{3}b^{2}+\frac{2\cdot
7^{2}}{3\cdot 5}b^{4}+\frac{2^{4}}{5\cdot 7}b^{6}\right)$ (A10)

$q_{9}\left(b\right)=-\left(1+2\cdot 7b^{2}+\frac{7\cdot 47}{2^{2}\cdot
5}b^{4}+\frac{3229}{2^{2}\cdot 3^{2}\cdot 5\cdot 7}b^{6}+\frac{5\cdot
7}{2^{7}\cdot 3^{2}}b^{8}\right)\ $ (A11)

$q_{10}\left(b\right)=\left(1+2^{2}\cdot 5b^{2}+\frac{2\cdot 7\cdot
13}{5}b^{4}+\frac{2^{4}\cdot 41}{3^{2}\cdot 7}b^{6}+\frac{2^{7}}{3^{2}\cdot
5\cdot 7}b^{8}\right)\ $ (A12)

$q_{11}\left(b\right)=-\left(1+\frac{5\cdot 11}{2}b^{2}+\frac{7\cdot 11\cdot
19}{2^{2}\cdot 5}b^{4}+\frac{11\cdot 1571}{2^{3}\cdot 3^{2}\cdot
7}b^{6}+\frac{11\cdot 59\cdot 181}{2^{7}\cdot 3^{2}\cdot 5\cdot
7}b^{8}+\frac{3^{2}\cdot 7}{2^{8}\cdot 11}b^{10}\right)\ \ $ (A13)

$q_{12}\left(b\right)=\left(1+\frac{2\cdot 5\cdot 11}{3}b^{2}+\frac{2\cdot
11\cdot 31}{5}b^{4}+\frac{2^{2}\cdot 11\cdot 139}{3^{2}\cdot
7}b^{6}+\frac{2^{3}\cdot 11\cdot 479}{3^{4}\cdot 5\cdot
7}b^{8}+\frac{2^{8}}{3^{2}\cdot 7\cdot 11}b^{10}\right)\ \ $ (A14)

$q_{13}\left(b\right)=-\left(1+\frac{11\cdot 13}{3}b^{2}+\frac{11\cdot 13\cdot
67}{2^{5}\cdot 5}b^{4}+\frac{11\cdot 13\cdot 17\cdot 127}{2^{2}\cdot
3^{2}\cdot 5\cdot 7}b^{6}+\frac{11\cdot 13\cdot 23\cdot 6679}{2^{7}\cdot
3^{4}\cdot 5\cdot 7}b^{8}+\right.$

$\left.+\frac{13\cdot 211\cdot 2609}{2^{7}\cdot 3^{2}\cdot 5^{2}\cdot 7\cdot
11}b^{10}+\frac{3\cdot 7\cdot 11}{2^{10}\cdot 13}b^{12}\right)\ \ \ $ (A15)

$q_{14}\left(b\right)=\left(1+\frac{2\cdot 7\cdot 13}{3}b^{2}+\frac{2\cdot
7\cdot 11\cdot 13}{5}b^{4}+\frac{2^{2}\cdot 11\cdot 13\cdot 311}{3^{2}\cdot
5\cdot 7}b^{6}+\frac{2^{4}\cdot 11\cdot 13\cdot 37}{3^{4}\cdot
5}b^{8}+\right.$

$\left.\frac{2^{6}\cdot 13\cdot 59}{3^{2}\cdot 5^{2}\cdot
11}b^{10}+\frac{2^{10}}{3\cdot 7\cdot 11\cdot 13}b^{12}\right)\ $ (A16)

$q_{15}\left(b\right)=-\left(1+\frac{5\cdot 7\cdot 13}{2\cdot
3}b^{2}+\frac{7^{2}\cdot 11^{2}\cdot 13}{2^{3}\cdot 3\cdot
5}b^{4}+\frac{11\cdot 13\cdot 8521}{2^{4}\cdot 3^{2}\cdot
7}b^{6}+\frac{11\cdot 13\cdot 79\cdot 2917}{2^{7}\cdot 3^{4}\cdot
5}b^{8}+\right.$

$\left.\frac{7\cdot 13\cdot 1206053}{2^{8}\cdot 3^{4}\cdot 5\cdot
11}b^{10}+\frac{17911\cdot 135721}{2^{10}\cdot 3^{3}\cdot 5^{2}\cdot 7\cdot
11\cdot 13}b^{12}+\frac{11\cdot 13}{2^{11}\cdot 5}b^{14}\right)\ $ (A17)

$q_{16}\left(b\right)=\left(1+\frac{2^{3}\cdot 5\cdot
7}{3}b^{2}+\frac{2^{2}\cdot 7\cdot 13\cdot 41}{3\cdot 5}b^{4}+\frac{2^{4}\cdot
11\cdot 13\cdot 67}{3^{2}\cdot 5\cdot 7}b^{6}+\frac{2\cdot 11\cdot 13\cdot
2473}{3^{4}\cdot 5}b^{8}+\right.$

$\left.\frac{2^{5}\cdot 13\cdot 4201}{3^{4}\cdot 5\cdot
11}b^{10}+\frac{2^{6}\cdot 266681}{3^{3}\cdot 5^{2}\cdot 7\cdot 11\cdot
13}b^{12}+\frac{2^{11}}{3^{2}\cdot 5\cdot 11\cdot 13}b^{14}\right)\ $ (A18)

###### Acknowledgement 1

The financial support of the ANCS project PN 09 37 01 06, of the JINR Dubna \-
IFIN-HH Magurele-Bucharest project no. 01-3-1072-2009/2013 and of the CEI
Cooperation Fund Project No. 1202.161-13 are kindly acknowledged.

## References

  * [1] V. V. Mitin, D. I. Sementsov, N. Z. Vagidov: Quantum Mechanics for Nanostructures, Cambridge University Press (2010)
  * [2] V. Barsan, R. Dragomir, Optoel.Adv.Mat - Rapid Commun. 6, 917 (2012)
  * [3] W.A. Harrison: Applied Quantum Mechanics, World Scientific (2000)
  * [4] S. Van Wyk: Computer Solutions in Physics, World Scientific (2011)
  * [5] S. Fluegge: Practical Quantum Mechanics, Springer-Verlag Berlin Heidelberg New York (1971)
  * [6] T. Ando, A. B. Fowler, F. Stern, Rev.Mod.Phys. 54, 437 (1982)
  * [7] R. M. Kolbas, N. Holonyak, Jr.(1984), Amer.J.Phys. 52, 431 (1984)
  * [8] B. Wu, Z. Zhang, Phys.Rev.B77, 035410 (2008)
  * [9] P. Czosche et al., Phys.Rev.Lett. 91, 226801 (2003)
  * [10] J. Kim et al., Proc.Natl.Ac.Sci. 107, 12761 (2010)
  * [11] V.B. Sandomirskii, JETF 52, 158 (1967); Sov.Phys. JETP 25, 101 (1967)
  * [12] F.K. Schulte, Surf.Sci. 55, 427 (1976)
  * [13] Z. Q. Qiu, N. V. Smith: J.Phys.:Cond.Matter 14, R169 (2002)
  * [14] W. A. Atkinson, A. J. Slavin, Amer.J.Phys. 74 43 (2008)
  * [15] B. I. Barker, G. H. Rayborn, J. W. Ioup, G. E. Ioup, Am.J.Phys. 59, 1038 (1991)
  * [16] D. L. Aronstein, C. R. Stroud, Amer.J.Phys. 68, 943 (2000)
  * [17] O. F. de Alcantara Bonfim, D. J. Griffiths, Amer.J.Phys. 74, 43 (2006)
  * [18] V. Barsan, Rom.Rep.Phys. 64, 685 (2012)
  * [19] V. V. Pogosov, V. P. Kurbatsky, E. V. Vasyutin, Phys.Rev.B195410 (2005)
  * [20] D. Marcuse, Light transmission optics, Van Nostrand, New York (1982)
  * [21] N. V. Smith, PhysRev B32, 3549 (1985)
  * [22] M. Milun, P. Pervan, D.P. Woodruff, Rep.Prog.Phys. 65, 99 (2002)
  * [23] S.-J. Tang et al. Phys.Rev.Lett. 107, 066802 (2011)
  * [24] T.-C. Chiang, Photoemission studies of QW states in thin films, Surf.Sci.Rep.39, 181 (2000)] and [Chiang2000PRB] PhysRev B61 1804 (2000)
  * [25] T.-C. Chiang, Phys.Rev. B61, 1804 (2000)
  * [26] C. Cohen-Tannoundji, B. Diu, F. Laloe: Quantum Mechanics, Wiley, New York (1977)
  * [27] J. J. Paggel, T. Miller, T.-C. Chiang, Science 283, 1709 (1999)
  * [28] J. K. Freericks: Transport in multilayered nanostructures, Imperial College Press, 2006
  * [29] R. J. Black, A. Ankiewicz, Am.J.Phys.53, 554 (1985)
  * [30] V. Barsan: Waveguides, resonant cavities, optical fibers and their quantum counterparts, in: V. Barsan, R. P. Lungu (Eds.): Trends in electromagnetism, InTech, 2011
  * [31] A. Venugopalan, A. G. Agarwal, Phys.Rev.A59, 1413 (1999)
  * [32] S. Garrett, Amer.J.Phys. 47, 195 (1979)
  * [33] D. L. Aronstein, C. R. Stroud, Phys.Rev.A55, 4526 (1997)
  * [34] H. C. Casey, Jr., M. B. Panish: Heterostructure lasers, Academic Press, New York, San Francisco, London (1978)


# Maximizing the Expected Value of a Lottery Ticket: How to Sell and When to
Buy

Allen Kim and Steven Skiena
Dept. of Computer Science
Stony Brook University
<EMAIL_ADDRESS>
(January 2, 2020)

###### Abstract

Unusually large prize pools in lotteries like Mega Millions and Powerball
attract additional bettors, which increases the likelihood that multiple
winners will have to share the pool. Thus, the expected value of a lottery
ticket decreases as the probability of collisions (two or more bettors with
identical winning tickets) increase. We propose a way to increase the expected
value of lottery tickets by minimizing collisions, while preserving the
independent generation necessary in a distributed point-of-sales environment.
Our approach involves partitioning the ticket space among different vendors
and pairing them off to ensure no collisions among pairs. Our analysis
demonstrates that this approach increases the expected value each ticket,
without increasing the size of the prize pool. We also analyze when ticket
sales have maximal expected value, and show that they provide positive returns
when the jackpot is between $775.2 million and $1.67 billion dollars.

##  1 Introduction

With players attracted by the potential winnings from enormous lottery pools,
multistate lotteries like Mega Millions and Powerball sell tens to hundreds of
millions of tickets each week across the United States. Larger lottery pools
attract more sales, but the real expected value of a particular lottery ticket
is a function of combinatorics, pool size, and consumer behavior.

Calculating the probability of winning a lottery is a standard exercise in
combinatorics [1, 2, 3, 4]. Each ticket for the Powerball lottery contains six
numbers, with five “white balls” in range from 1 to 69, plus one “powerball”
in the range from 1 to 26. The grand prize requires selecting all of these
numbers correctly. Thus there are

$\binom{69}{5}\binom{26}{1}=292,201,338$

possible tickets, making for very low odds of winning the jackpot. Similar
rules hold for Mega Millions and other lottery games.

The payoff for a winning ticket varies each week, depending on the size of the
prize pool. The pool for Powerball starts at $40 million, but increases each
week until there is a winner. On January 13, 2016 it reached a record high of
$1.586 billion.

Players like to win, but they do not like to share. Even the largest lottery
pool will yield a disappointing payoff if too many players independently
select the winning ticket. And multiple winners become a genuine risk once the
pools get big enough [5]. Indeed, fully six of the ten biggest
Powerball/MegaMillions jackpots (as of March 28, 2019) had multiple winners.
Two of these big jackpots had to be shared three ways.

In this paper, we propose and analyze a practical scheme to increase the
likelihood of single winners, or equivalently to minimize the probability of
sharing. Paradoxically, this manages to increase the expected value of a
lottery ticket without costing the central authorities any additional
contributions to the payoff pool. Given that larger potential winnings attract
more players, we anticipate that implementation of our scheme would generate
increased interest in these games, and enlarge the ostensible benefits the
governments running them can provide.

Further, we demonstrate that the number of Powerball tickets bought increases
quadratically with pool size, which implies that tickets become increasing
less valuable after the pool passes a critical threshold. This analysis
enables us to determine the range of pool sizes where tickets have positive
expected value. In particular, we establish that Powerball tickets bought
(under the current sales model) with pool sizes between $775.2 million and
$1.6656 billion have positive expected value.

##  2 Selecting Lottery Tickets with Quick Picks

Purchasers of Powerball and Mega Millions tickets have the option to select
the combination for each ticket they buy, and roughly 30% of tickets are sold
with such self-selected combinations [6]. But self-selection leads to a
greater likelihood of collisions, where multiple players pick the same
combination and hence must share the prize pool should they win. People tend
to choose numbers that are meaningful to them, such as dates and arithmetic
progressions. This lack of independence skews certain combinations to be
selected far more often than would be suggested by chance [7].

The remaining 70% of tickets for these lotteries are sold through Quick Picks,
where the point-of-sale terminal generates a combination at random. Details of
the generation algorithm are not available to us, but we presume that
something like a standard linear congruential generator (LCG) is used to
produce pseudorandom numbers. These generators iteratively produce a sequence
of values using the recurrence relation

$X_{n+1}=\left(a\cdot X_{n}+c\right)\mod m$

Instantiated with appropriate constants $a$, $c$, and $m$, one can permute
through all the values of $m$ before repeating. See Knuth [8] for a thorough
discussion on the theory of random number generation.

Our presumption is that such methods do an effective job selecting tickets
with uniform probability on each sales terminal. But under the well known
birthday paradox, collisions occur surprisingly early in any such independent
sampling strategy. We expect the first collision to happen after about
$\sqrt{\frac{\pi N}{2}}\approx 1.25\sqrt{N}$ tickets sold, where $N$ is the
size of the ticket space. For Powerball, where $N=$ 292,201,338, this works
out to an expected sales collision after only 21,367 tickets are sold.

The problem of collisions is further complicated because tickets are sold
simultaneously at thousands of terminals across the nation. Synchronization of
the random number generators across these machines (with the same constants
$a$, $c$, $m$, and initial $X_{0}$) would be disastrous, because the same
combinations would get sold repeatedly by different stores.

Quick Pick works independently across different lottery terminals. Kelly
Cripe, spokeswoman for the Multi-State Lottery Association which runs
Powerball, stated that Quick Picks “has no memory of what it previously
selected” as an explanation for why multiple players can get identical
combinations [9]. Presuming that the constants and initializations of the
random number generators have been chosen correctly, the collection of tickets
across stores should be generated independently, with the resultant collision
probabilities well defined as a function of the number of tickets sold.

All of this leads to the question of whether it is possible to construct an
efficient distributed lottery scheme such that the probability of having to
share the prize is minimized.

##  3 Distributed Strategies to Generate Tickets

We consider a setting where $m$ stores independently generate tickets on
demand. Each distinct lottery ticket can be ranked, or equivallently put in a
bijection with a distinct integer ranging from 0 to $N-1$. It is a
straightforward task to unrank each such integer into a ticket, as well as the
inverse operation of ranking each ticket to corresponding integer using a a
recursive combinatoric approach. We discuss such operation in the appendix.

In our analysis, we consider a ticket as winning only if it claims part of the
grand prize, ignoring smaller prizes granted for similar but incomplete
matches. We assume the winning ticket will be drawn uniformly at random over
the ticket space. To simplify our analysis, we assume that that all tickets
are bought through a Quick Pick mechanism, meaning that customers cannot or do
not selected their own combinations.

Our goal here is to devise an efficient, distributed mechanism to implement
Quick Pick so as to optimize the expected value of a ticket, given that $n$
tickets have been sold. We consider three different models:

  * •

Independent Generation – This is the simplest ticket generation strategy, and
the one presumably implemented in current lottery point-of-sales terminals.
Each store generates a integer in the ticket space from $0$ to $N-1$ uniformly
at random on demand for each customer, which is unranked to generate an
appropriate combination. Equivalently, the process of selecting balls from an
urn could be simulated to generate tickets on demand.

Under such a system, each of the $m$ stores generate tickets independently,
without memory of what they or any other store have generated in the past. The
downside is that no mechanism exists to prevent the same ticket being
generated twice, in different stores or even the same store.

  * •

Central Server Generation – At the other end of the spectrum, we consider a
central server that stores communicate with, that ensures no duplicate ticket
ever gets sold until the $(N+1)$st request.

Such a server could be implemented constructing a random permutation of the
entire ticket space, and respond to the $i$th ticket request with the $i$th
element in this ordering. Alternately, we can represent the ticket space as a
bit vector, and search from a randomly selected position $0\leq x\leq N-1$ to
return the first open index $i\geq x$. After $N$ tickets have been sold, every
subsequent ticket sold after will result in a collision, but this is clearly
unavoidable due to the pigeonhole principle.

Although this central server idea appears to be optimal in terms of preventing
collisions, it requires constant communication between each sales terminal and
the server. If at any point the connectivity is lost, tickets cannot be
dispensed. We seek a generation approach where ticket machines can work
independently, without any need of external communication while still
minimizing collisions.

  * •

Deterministic Pairing – Here we propose a strategy where each store is
assigned a “partner”, such that each store and its partner comprise a pair.
Thus $m$ stores yield $p=\lceil m/2\rceil$ pairs. We partition the ticket
space $N$ into $p$ regions, and assign a distinct region of size $N/p$ to each
pair. This represents the range of tickets that a particular pair is allowed
to sell from. (Recall that each possible ticket is represented by a distinct
integer from 0 to $N-1$.)

One of the stores in each pair sells tickets in increasing order from the
front of the region, while the other store sells tickets in decreasing order
from the back. This guarantees that no collisions will occur for each pair
until they exhaust the entire region, making it optimal for two stores. After
the store partners and ticket ranges have been assigned, stores need not
communicate further with any external party.

##  4 Combinatorial Analysis

We now determine the expected value of a purchased ticket, given that $k$
tickets have been sold. Let $P$ be the prize pool for a winning ticket, and
$N$ be the size of the ticket space. We first consider the expected value of a
single ticket. If the contribution of this ticket is unique among all tickets
sold, then its expected value is $P/N$, because the probability of it winning
is $1/N$ and the prize if it wins is $P$. If the ticket is not unique and
shares its numbers with $g$ tickets in total, then its expected value is
$P/(gN)$ since the prize would now be split among $g$ people resulting in a
prize of $P/g$.

To get the expected value of a purchased ticket, we sum over all the expected
prizes for each ticket and divide by the total number of tickets. To find the
sum of these expected prizes, we make the following observation. If we
consider just a single set of $g$ tickets that share the same numbers, then
the sum of the expected values for those tickets will always be $P/N$,
regardless of $g$. This is due to the fact that for a given ticket number with
$g$ collisions, each ticket in the same set will have expected value $P/(gN)$
and since we have $g$ of them, we get a total expected value sum of
$P/(gN)*g=P/N$. Thus, to compute the expected value sum over all tickets, we
simply need to count the number of distinct ticket numbers and multiply this
value by $P/N$.

In summary, the expected value of each ticket is simply the number of distinct
tickets sold multiplied by $P/(kN)$, where $k$ the number of tickets sold so
far.

###  4.1 Independent Random Generation

In the case of independent random generation, the number of distinct tickets
can be computed analogously to the number of distinct birthdays among a random
sample of $k$ people.

This is a known problem, but to motivate the solution, we assume we know how
to compute the number of distinct birthdays for $k-1$ people, and consider
what happens when we add a new person $k$. The probability $k$ does not share
a birthday with any of the original $k-1$ people is
$\left(\frac{N-1}{N}\right)^{k-1}$, and we can simply increase the expected
value by 1 in such a case. In the other scenario, the new person does not
contribute to the number of distinct birthdays, so the value does not
increase.

This is summarized by the following recurrence, where $N$ is the size of the
ticket space:

$\displaystyle E(k)$
$\displaystyle=\left(\frac{N-1}{N}\right)^{k-1}\left[1+E(k-1)\right]+\left(1-\left(\frac{N-1}{N}\right)^{k-1}\right)\left[E(k-1)\right]$
$\displaystyle=\left(\frac{N-1}{N}\right)^{k-1}+E(k-1)$
$\displaystyle=\sum_{i=0}^{k-1}\left(\frac{N-1}{N}\right)^{i}=\frac{1-\left(\frac{N-1}{N}\right)^{k}}{1-\left(\frac{N-1}{N}\right)}$
$\displaystyle=N\cdot\left(1-\left(\frac{N-1}{N}\right)^{k}\right)$

To get the final expected value, we multiply by $P/(kN)$ to get:

$E_{\mathit{IR}}(k)=\left[1-\left(\frac{N-1}{N}\right)^{k}\right]\cdot P/k$

###  4.2 Central Server

In the case of the central server, each ticket contributes to a unique number.
Thus, the expected number of distinct tickets is equal to the number of
tickets sold until $N$ tickets are sold. At that point, the maximum number of
distinct tickets are sold. The expected value of each ticket is given by:

$E_{\mathit{CS}}(k)=\begin{cases}P/N&k\leq N\\\ \frac{P}{k}&k>N\end{cases}$

###  4.3 Deterministic Pairing

The deterministic pairing scheme can be modeled by considering a balls and
bins problem with a limited capacity $c$ for each bin, where the balls
represent a ticket, and the bins represent the partitions of the ticket space.
A ball is discarded whenever it is thrown into a full bin. This captures the
fact that the ticket values are recycled after a partition of the ticket space
is all used up. We calculate the total number of balls remaining in the bins
after $k$ balls are thrown. This value of the number of balls remaining
represents the number of distinct tickets sold so far. In the worst case, all
the balls get thrown into a single bin and $k-c$ balls are discarded, but this
is highly unlikely.

We solve this analytically for the case of two bins with $c=N/2$. This is
equivalent to considering two pairs of stores with an even partition of the
ticket space with size $N/2$ each. The expected value of random variable $X$
with outcome values $x_{i}$, each with probability $p_{i}$:

$E(X)=\sum_{i=1}^{k}p_{i}x_{i}$

In this setting, we wish to consider every possible sequence of ball tosses.
We can represent this as a binary string, in which 0 represents the left bin
and 1 represents the right bin. The $i$th bit of the string will represent the
$i$th ball thrown. We consider all binary strings of length $k$, and compute
the expected value by summing over the values when there are $i$ zeros and
$k-i$ ones directly for all $i$.

The values, in this case, are the minimum between $i$ (or $k-i$) and $N/2$.
This reflects the discarding aspect as a bin cannot have more than $N/2$
balls. Thus, our final expected value, given $k$ tickets, is:

$E_{\mathit{DP}}(k)=\sum_{i=0}^{k}\frac{\binom{n}{i}}{2^{k}}\cdot\frac{N}{kP}\Big{.}\left[\min\left(i,\frac{N}{2}\right)+\min\left(k-i,\frac{N}{2}\right)\Big{.}\right]$

Figure 1: The expected fraction of the pool size claimed over all tickets sold
under three different models, for $N=100,000$. The deterministic pairing model
approaches the impractical central server model, while strictly dominating
independent generation.

We provide simulation results in Figure 1, for $N=100,000$.For the expected
value of purchased tickets, we see that the central server method is the best
(although impractical to implement) maximizes expected value because it
guarantees that each ticket in the ticket space is sold at least once each
before any combination repeats. The random independent strategy does the worst
of the three methods as collisions arise relatively quickly. The deterministic
pairing method does quite well as it nearly does as well as the ideal server
model, making it best among practical methods.

##  5 When to Buy to Maximize the Expected Value of a Ticket

We now analyze at what point in the jackpot is the expected value of a ticket
maximal. To do so, we first estimate the number of tickets sold for a given
jackpot size. We do this by collecting data on lottery ticket sales across the
United States for Powerball 111https://lottoreport.com/ticketcomparison.htm.
By graphing the number of tickets sold as a function of the jackpot, we note
that the curve is approximately quadratic. Thus, we run linear regression to
find the best fit quadratic formula. If $T(j)$ is defined to be a function of
the jackpot that outputs the number of tickets sold, we find that it is
approximately:

$T(j)=278.36j^{2}-5364.95j+10582740.74$

Here $j$ is measured in terms of millions of dollars.

Figure 2: The number of tickets sold as a function of the jackpot

Given this model, we can evaluate $E_{IR}(j)$, the expected value of a ticket
for a given jackpot. Recall the expected value of a ticket can be computed for
the random independent generation scheme, where $k=T(j)$ is the number of
tickets sold and $N$ is the size of the ticket space (the size of the ticket
space $N$ is 292,201,338 for Powerball), as

$E_{IR}(j)=\left[1-\left(\frac{N-1}{N}\right)^{T(j)}\right]\cdot P/T(j)$

Similarly, for the (ideal) central server approach, we evaluate
$E_{\mathit{CS}}(j)$, as

$E_{CS}(j)=\begin{cases}\frac{P}{N}&T(j)\leq N\\\
\frac{P}{T(j)}&T(j)>N\end{cases}$

In the end, we get the following results presented in Figure 3. The cost of
each lottery ticket is $2, so we are interested in situations when the
expected value of a ticket is greater than $2. We see that for the standard
Quick Pick scheme, one can expect to see returns when the jackpot is between
$775 million and $1.67 billion. Here we see that a ticket provides its maximal
return when the jackpot is around $1.02 billion. But as the jackpot grows
larger and larger, the expected number of tickets to be sold grows
quadratically, and hence, the number of collisions overwhelm the returns of
the jackpot. It becomes more and more likely that it will need to be shared
among more people.

We note that under our proposed scheme, the range of the jackpot with positive
expected returns is larger, between $584 million and $1.79 billion. As the
pool size continues to increase, the expected value converges towards the
standard Quick Pick method, but the expected value of our scheme is always
larger than that of the standard Quick Pick method at all times, providing
greater incentives for smart customers.

Figure 3: The expected value of a Powerball ticket under the Quick
Pick/independent generation (blue) and maximally collision avoiding (red)
sales models, assuming the number of tickets sold grows quadratically with the
pool size.

##  6 Conclusion

We propose an alternative to the standard ticket generation scheme used in
popular lotteries that generally minimizes collisions and raises the expected
value of a ticket. Our deterministic pairing method only requires an agreed
setup between the lottery associate and its distributors. No further
communication is required during sales. For future work, one may consider
adding some degree of communication to establish how much more this method can
be improved upon. Analyzing the impact of non-uniform ticket sales among
stores (some more popular than others) is another factor to consider as well.

The reader may wonder what the catch is with our ticket generation procedure.
How can we really increase expected value by affecting sales strategy, without
any change in the cost of the lottery pool? Over the course of a single
lottery, it is clear that we accomplish our goals. But there are certain
subtleties in running a sequence of lotteries, where the pools increase
whenever there is no winner the previous week. By reducing duplicates entries,
we increase the likelihood that prize will be claimed each week. Over a
sequence of lotteries, our scheme will create fewer large pools resulting from
long runs of unsuccessful contests. But no one likes to share, and a lucky
winner would be more likely to keep all of it.

## References

  * [1] Z. Füredi, G. J. Székely, and Z. Zubor, “On the lottery problem,” Journal of Combinatorial Designs, vol. 4, no. 1, pp. 5–10, 1996.
  * [2] C. Barboianu, The mathematics of lottery: odds, combinations, systems.  Lightning Source ;, 2009.
  * [3] V. Lim, E. Deahl, L. Rubel, and S. Williams, Local Lotto.  IGI Global, 2015.
  * [4] V. Lim, L. Rubel, L. Shookhoff, M. Sullivan, and S. Williams, “The lottery is a mathematics powerball,” Mathematics Teaching in the Middle School, vol. 21, no. 9, pp. 526–532, 2016.
  * [5] “Jackpot history,” 2019.  https://www.megamillions.com/jackpot-history.
  * [6] M. Keneally, “How to pick your powerball lottery numbers,” Jan 2016.  https://abcnews.go.com/US/pick-powerball-lottery-numbers/story?id=36113250.
  * [7] N. Wells, “It’s not a good idea to buy quick pick,” Jan 2016.  https://www.cnbc.com/2016/01/13/its-not-a-good-idea-to-buy-quick-pick.html.
  * [8] D. E. Knuth, The Art of Computer Programming, Volume 2 (3rd Ed.): Seminumerical Algorithms.  Boston, MA, USA: Addison-Wesley Longman Publishing Co., Inc., 1997.
  * [9] M. Rocheleau, “More than half of powerball tickets sold this time will be duplicates.” https://www.bostonglobe.com/metro/2016/01/13/copycats-more-than-half-powerball-tickets-sold-this-time-will-duplicates/ZIn5u0Cm2KgGZnwWSZ4UBO/story.html, Jan 2016.

##  7 Appendix

We describe a process of converting an integer n (rank) into a sequence of
numbers (a lottery ticket). The reverse, going from ticket to rank, can be
done in a similar manner, where the steps are nearly reversed. Recall that a
lottery ticket consists of 5 integers from 1 to 69 (white balls), and a sixth
integer ranging from 1 to 26 (the “powerball”). In this case, n must be at
least 0 and less than 292,201,338. We first consider generating just the white
balls in the range from 0 to 68 (we simply add 1 to each ball in the end).

Our approach is to generate each number sequentially, keeping track of a lower
bound to ensure a strictly increasing order. Let GenTicket(n,l,s) be a
function where n is the rank in question, l is a lower bound for the numbers
we are allowed to use, and outputs a sequence of s integers in strictly
increasing order with values at least 0 and less than h (globally provided).
To generate the white balls, we would call GenTicket(n,0,5), where n is the
rank and h is globally provided as 69. We can define GenTicket as follows,
where Binom(n,k) counts the number of combinations to choose k out of n
objects:

    global h : upper bound of ticket numbers
    function GenTicket(n,l,s):
      if s == 1:
        return [n + l]
      else:
        i = 1
        while n >= Binom(h - l - i, s - 1):
          n -= Binom(h - l - i, s - 1)
          i += 1
        return [l + i - 1] + GenTicket(n, l + i, s - 1)

Intuitively, we use Binom to determine how many tickets there are starting
with the given lower bound, and continuously reduce the ticket space until we
know the range in which the first number should lie. Then, we can recursively
compute the rest of the ticket.

For the remaining powerball, we simply divide the integer n by the total
number of possible white balls (11,238,513 for Powerball) to get the powerball
number. As long as n is within the possible number of tickets, this will
compute the appropriate “level” in the ticket space.

Note that the first ($n=0$) ticket would be $(1,2,3,4,5,1)$ and the last
($n=292,201,337$) ticket would be $(65,66,67,68,69,26)$. As an example, we
show the computation to find the 100,000,000th ticket. We solve with 0-based
indexing, so at the end, we increase each value by 1 to get the standard
ticket values.

We first divide $n=$ 100,000,000 by 11,238,513 to get the Powerball number,
which is 8. Now, we find the remainder of $n$ when divided by 11,238,513 to
get 10,091,896, which represents the rank that we have to compute the values
of the white balls for. We go step by step through the process to show how
intermediate values are determined.

    # Our starting point
    (?, ?, ?, ?, ?, 8)
    n: 10091896, lower bound: 0, size: 5

    # We want to check if 0 can be our first number
    # The number of tickets with 0 as the first number is Binom(68,4)
    # But since 10091896 > Binom(68,4), we know it cannot be 0.
    # We reduce to get a new n = 10091896 - Binom(68,4) = 9277511.

    # We continue the process. We can rule out 1 as the first number
    # because 9277511 > Binom(67,4): n = 9277511 - Binom(67,4) = 8511031
    # ...repeat 24 iterations in total...
    # Finally, we get that 75142 < Binom(44,4). Our ticket lies in this set.
    # Since we iterated 24 times from 0, our first number must be 24.
    # We recursively repeat the process.

    (24, ?, ?, ?, ?, 8)
    n: 75142, lower bound: 25, size: 4
    # Since we have used 24, our new lower bound is 25.
    # Our new size is 4 since we only have 4 more to fill now.
    # 62801 = 75142 - Binom(43,3)
    # ...total 7 iterations...
    # 5436 < Binom(36,3)
    # Thus, we add 7 more to the new lower bound.

    (24, 32, ?, ?, ?, 8)
    n: 5436, l: 33, size: 3
    # 4841 = 5436 - Binom(35,2)
    # ...total 13 iterations...
    # 67 < Binom(22,2)

    (24, 32, 46, ?, ?, 8)
    n: 67, l: 47, size: 2
    # 46 = 67 - Binom(21,1)
    # 26 = 46 - Binom(20,1)
    # 7 < Binom(19,1)

    (24, 32, 46, 50, ?, 8)
    n: 7, low: 51, size: 1
    # Since size = 1, we can return low + n.

    # Final result
    (24, 32, 46, 50, 58, 8)

In the end, we increment each value by 1 to have every value start at 1, and
we find that the 100,000,000th ticket is (25, 33, 47, 51, 59, 9).