Keywords

1 Hadamard Matrices

An HadamardFootnote 1 matrix is a square matrix H n of order n with entries ± 1 and whose rows (or columns vice versa) are mutually orthogonal, see Seberry [24]. If H n is Hadamard matrix, then \({\mathbf {H}}_n{\mathbf {H}}_n^\top = n{\mathbf {I}}_n\). An Hadamard matrix remains so when any row or column is multiplied by − 1. Having this into consideration, one can always write an Hadamard matrix with its first row and first column having only + 1’s, that it is the normal form of an Hadamard matrix, see Sylvester [26].

If H n exists for n = 1, then H 2 can be written like the one below:

$$\displaystyle \begin{aligned} {\mathbf{H}}_2 = \left[ \begin{array}{rrr} 1 & & 1 \\ 1 & & -1 \end{array} \right]. \end{aligned}$$

More examples of Hadamard matrices:

The necessary condition for the existence of an Hadamard matrix H n, n > 2 is that n ≡ 0(mod4); more about this can be found on Hall [8]. Hadamard matrices for all permissible values of n ≤ 100, with the exception of n = 92 can be found on Plackett and Burman [18]. Only later on Baumert et al. [1] presented an Hadamard matrix of order 92.

According to Hedayat and Wallis [9] and to Sawade [23] Hadamard matrices have their existence confirmed for all permissible values of n ≤ 424.

If H m and H n are Hadamard matrices of orders m and n, respectively, then their tensor product H m ⊗H n is an Hadamard matrix of order mn, where ⊗ denotes the Kronecker matrix product. So, in particular, an Hadamard matrix H n of order n where n = 2s and s ≥ 2 is an integer can be built by taking the s-fold tensor product of H 2 with itself, as it is given below:

$$\displaystyle \begin{aligned} {\mathbf{H}}_{2^s} = \underbrace{{\mathbf{H}}_2 \otimes {\mathbf{H}}_2 \otimes \cdots \otimes {\mathbf{H}}_2}_{s\mbox{ times}}. \end{aligned}$$

Hadamard matrices are very well known because of the wide range of applications, not only in several areas of mathematics, but also in other sciences and mainly those connected with new technological advances, like cryptography Ogata et al. [15], image analysis, signal processing, coding theory and algorithm design, see e.g. Francisco [6]. In Statistics, Combinatorial Designs and Experimental design the Hadamard matrices play a key role in the block design construction. We refer to Din and Mavron [5] and to Koukouvinos [11] where one can see how these matrices are useful for the construction of BIBD (balanced incomplete block design)—see Sect. 2—, and for designs and secret sharing schemes, respectively.

2 Relationship Between Hadamard Matrices and BIBD

Consider now an Hadamard matrix H 4u, which without loss of generality is assumed to be in its normal form. Delete from H 4u, its first row and first column of all ones, thus obtaining a matrix A of order (4u − 1) × (4u − 1).

Taking A we can define \(\mathbf {N} = \frac {1}{2} \left ( \mathbf {A} + {\mathbf {J}}_{4u-1} \right )\), where \({\mathbf {J}}_u = {\mathbf {1}}_u {\mathbf {1}}_u^\top \).

This means that N is obtained from A, by replacing the − 1’s in A by zero and keeping + 1’s unaltered. Then, it is easy to see that N is the incidence matrix of a balanced incomplete block design (BIBD) with parameters:

$$\displaystyle \begin{aligned} \begin{array}{ccccc} v= 4u-1 = b & ; & r=2u-1=k & ; & \lambda=u-1 \end{array} \end{aligned} $$
(1)

as presented by Yates, see [28], in his agriculture experiments, where these parameters would stand for v varieties in b blocks of size k, so that each variety occurs exactly r times along the blocks and every pair of varieties concurs in exactly λ blocks, see Raghvarao [19].

Conversely, if N is the incidence matrix of a BIBD with parameters given by (1), then by replacing the 0’s in N by − 1 and bordering the resultant matrix by a row and column of all ones, one gets an Hadamard matrix of order 4u.

We thus have the following theorem

Theorem 1

The existence of an Hadamard matrix of order 4u is equivalent to the existence of a BIBD with parameters given by (1).

Example 1

Consider an Hadamard matrix H 16 which can be obtained by forming the tensor product H 4 ⊗H 4, where H 4 is as below:

$$\displaystyle \begin{aligned} {\mathbf{H}}_4 = \left[ \begin{array}{rrrrrrr} 1 & & 1 & & 1 & & 1 \\ 1 & & -1 & & 1 & & -1 \\ 1 & & 1 & & -1 & & -1 \\ 1 & & -1 & & -1 & & 1 \end{array} \right] \end{aligned}$$

Following the construction method described above, we get a solution of a BIBD with parameters v = 15 = b, r = 7 = k, λ = 3.

A review of several construction methods to synthesize these matrices was presented by Oliveira [16, 17], namely Paley Matrices, Sylvester Matrices and Kronecker recursive product. We also refer to Stinson [25] and Cameron [4], as well as to the webpage

http://mathworld.wolfram.com/HadamardMatrix.html

for more examples of such matrices.

Now consider the BIBD (7,7,3,3,1) and the BIBD(13,13,4,4,1). If we add a row and a column of 1’s, and if we replace all the null entrances in the matrix by (1), we obtain the following Hadamard matrices:

$$\displaystyle \begin{aligned} {\mathbf{H}}_7 = \left[ \begin{array}{rrrrrrrrrrrrrrr} 1 & & -1 & & -1 & & -1 & & 1 & & -1 & & 1 & & 1 \\ 1 & & 1 & & 1 & & -1 & & -1 & & 1 & & -1 & & 1 \\ -1 & & 1 & & 1 & & -1 & & -1 & & -1 & & 1 & & 1 \\ 1 & & -1 & & 1 & & 1 & & -1 & & -1 & & -1 & & 1 \\ -1 & & 1 & & -1 & & 1 & & 1 & & -1 & & -1 & & 1 \\ -1 & & -1 & & -1 & & 1 & & -1 & & 1 & & 1 & & 1 \\ 1 & & 1 & & 1 & & 1 & & 1 & & 1 & & 1 & & 1 \end{array} \right] \end{aligned}$$
$$\displaystyle \begin{aligned} {\mathbf{H}}_{13} = \left[ \begin{array}{rrrrrrrrrrrrrrrrrrrrrrrrrrr} 1 & & 1 & & 1 & & 1 & & 1 & & 1 & & 1 & & 1 & & 1 & & 1 & & 1 & & 1 & & 1 & & 1 \\ 1 & & 1 & & 1 & & 1 & & 1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 \\ 1 & & 1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 \\ 1 & & -1 & & 1 & & -1 & & -1 & & 1 & & -1 & & -1 & & 1 & & 1 & & -1 & & -1 & & -1 & & -1 \\ 1 & & -1 & & -1 & & 1 & & -1 & & -1 & & 1 & & -1 & & 1 & & -1 & & 1 & & -1 & & -1 & & -1 \\ 1 & & -1 & & -1 & & -1 & & 1 & & 1 & & -1 & & -1 & & -1 & & -1 & & 1 & & 1 & & -1 & & -1 \\ 1 & & -1 & & 1 & & -1 & & -1 & & -1 & & 1 & & -1 & & -1 & & -1 & & -1 & & 1 & & 1 & & -1 \\ 1 & & -1 & & -1 & & 1 & & -1 & & 1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & 1 & & 1 \\ 1 & & 1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & 1 & & -1 & & -1 & & 1 & & -1 & & 1 \\ 1 & & 1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & -1 & & 1 & & 1 & & -1 & & 1 & & -1 \\ 1 & & -1 & & -1 & & -1 & & 1 & & -1 & & -1 & & 1 & & 1 & & -1 & & -1 & & -1 & & 1 & & -1 \\ 1 & & -1 & & -1 & & 1 & & -1 & & -1 & & -1 & & 1 & & -1 & & 1 & & -1 & & 1 & & -1 & & -1 \\ 1 & & -1 & & -1 & & -1 & & 1 & & -1 & & 1 & & -1 & & -1 & & 1 & & -1 & & -1 & & -1 & & 1 \\ 1 & & -1 & & 1 & & -1 & & -1 & & -1 & & -1 & & 1 & & -1 & & -1 & & 1 & & -1 & & -1 & & 1 \end{array} \right] \end{aligned}$$

Sometimes in the literature Hadamard matrices are represented by a square in black and white, as we can have for our examples. Using this form, in figures, see Figs. 1 and 2, we present Hadamard matrices corresponding to the BIBD(7,7,3,3,1) and BIBD (13,13,4,4,1), from [16, 17].

Fig. 1
figure 1

BIBD (7,7,3,3,1)

Fig. 2
figure 2

BIBD (13,13,4,4,1)

3 BIBD and R Project for Statistical Computing

As stated before, a BIBD is an arrangement of v treatments (varieties) in b blocks, each of size k(< v), where each variety occurs exactly r times and every pair of varieties concurs in exactly λ blocks. The necessary, but not sufficient conditions for the existence of a BIBD are:

$$\displaystyle \begin{aligned} \left\{ \begin{array}{l} v < b \\ vr = bk \\ \lambda (v-1) = r(k-1) \end{array} \right. \end{aligned}$$

In order to generate BIBD with the aid of the computational statistical program ‘R’, we can use the extra ‘package’, ‘crossdes’. This ‘package’ includes several functions that assist in building balanced designs. Each BIBD produced with the aid of this ‘package’ has five parameters described above. To install the ‘package’ the command ‘install.packages (“crossdes”)’ is used. To load the ‘package’ in order to be able to use the functions contained herein, the command ‘library (“crossdes”)’ is used. The ‘find.BIB’ function is used to generate a block design with a specific number of treatments, blocks (which correspond to the lines of the generated design) and elements per block (corresponding to the columns of the generated design). It is also possible to use another function to test if the generated design meets the conditions to be a BIBD. For instance, to create a design with five treatments in four blocks of three elements the function is as follows (Fig. 3):

Fig. 3
figure 3

Output of instruction find.BIB(5,4,3)

> find.BIB(5, 4, 3)

The corresponding ‘R’ output is:

The resulting structure is not a BIBD because the treatments are not all repeated the same number of times. This observation can be confirmed by using the ‘isGYD’ function as follows: ‘isGYD (find.BIB (5, 4, 3))’. The result of executing this function in ‘R’ is (Fig. 4):

Fig. 4
figure 4

Output of instruction isGYD(find.BIB(5,4,3))

Consider now another example, this time with seven treatments and seven blocks of three elements (Fig. 5):

Fig. 5
figure 5

Output of instruction find.BIB(7,7,3)

It is confirmed through the use of the ‘isGYD’ function that this experimental design is indeed a BIBD:

Another useful ‘package’ to generate outlines designs for BIBDs is the ‘dae’. As the one above, this package has several different functions targeted to aid in obtaining experimental designs. The following example illustrates the use of one of the features of “dae”, the “fac.layout” to generate an experiment of BIBD consisting of randomized factors (Fig. 6):

Fig. 6
figure 6

Output of instruction isGYD(find.BIB(7,7,3))

A page from CRAN—The Comprehensive R Archive Network—aggregates all the existing information about the various ‘packages’ related to experimental design with the aid of the ‘R’. This page can be found at the url: http://cran.r-project.org/web/views/ExperimentalDesign.html.

This page presents first the general-purpose packages and proceeds with those that perform more specific tasks such as the ones used in the design of experiments for agriculture, industry and clinical trials among others (Fig. 7).

Fig. 7
figure 7

Randomized factors BIBD with 3 treatments and 4 blocks

4 Application of Hadamard Matrices to Error Correction

Reed–Muller codes, see Reed [20] and Muller [14], are a family of linear error-correcting codes that were first used in communications.

Special cases of Reed–Muller codes include the Hadamard code, the Walsh–Hadamard code and the Reed–Solomon code, see Wicker and Bhargava [27].

The Hadamard code is an error-correcting code that is used for error detection and correction when transmitting messages over very noisy or unreliable channels. A famous application of the Hadamard code was the NASA space probe Mariner 9 in 1971, where the code was used to transmit photos of Mars.

Generalized Hadamard codes are obtained from an n × n Hadamard matrix H. In particular, the 2n codewords of the code are the rows of H and the rows of H. To obtain a code over the alphabet {0, 1}, the mapping 1↦1, 1↦0, or, equivalently, x↦(1x)∕2, is applied to the matrix elements. That the minimum distance of the code is n∕2 follows from the defining property of Hadamard matrices, namely that their rows are mutually orthogonal.

To get the punctured Hadamard code with n = 2k−1 the chosen Hadamard matrix H has to be of Sylvester type, see [13], which gives rise to a message length of log2(2n) = k.

Quick response codes (QR-Codes) contain codewords that are 8 bits long and use the Reed–Solomon error correction algorithm with four different error correction levels. It is well known that higher the error correction level, the less the available storage capacity there is.

The Reed-Solomon algorithm was created by Irving Reed and Gustave Solomon, both engineers at MIT’s Lincoln Labs, and their work, see Reed and Solomon [21], led to the extent of and later on used with the creation of the QR code in 1994 for the Japanese automotive industry by Denso Wave, a subsidiary that produces automatic identification products.

Since its debut a long way was overcome and the amount of information that a QR code may store is massive. The four levels of security, that include redundant information, may go up to 30%, allowing the retrieval of information even when the QR code is damaged and thus giving space for error correction.

Below some examples of the relation between QR codes and information capacity (Figs. 8, 9 and 10).

Fig. 8
figure 8

Version 1, 21 × 21 blocks

Fig. 9
figure 9

Version 1, 25 × 25 blocks

Fig. 10
figure 10

Version 40, 117 × 117 blocks

Crossing the level of information redundant and the number of characters, Version 1, will allow 41 characters at his lowest and 17 on its highest level. Version 40 allows 7089 numerical characters.

Reed-Solomon codes are of the same family of error correcting codes as the Hadamard codes. The rows of a k × v generating matrix, for a generalized Reed-Solomon code GR k(c, 1), where c = (1, c, …, c v−1) for some c ∈ GF(q), of order v, are rows of a cocyclic matrix. For v = p, an odd prime number, the resulting Reed-Solomon codes are cocyclic Hadamard codes. So Reed-Solomon codes are closely related to Hadamard matrices as well.

5 Biometry

In information technology, biometrics refers technologies to identify human body characteristics, such as fingerprints and iris, see Jain et al. [10]. However, there is a tremendous amount of research that demonstrates biometrics can be easily faked. There are several examples on the Internet on how to make false fingerprints or forge iris images, big companies like Facebook are making efforts to develop both hardware tokens and software-based authentication for their social network. Software code generation like QR Codes seem to offer a preferable solution, rather than biometric recognition, thanks to their mathematical properties, see Gonçalves [7].

Gregg Stefancik, a Facebook engineer has stated in an interview that he would like his company to eventually move away from using passwords, but opposes the use of biometrics. However biometrics security can be leveraged with a two-factor authentication solution, ensuring that alphanumeric passwords or generated codes enter the authentication steps, see Anongporn [22]. A combination of voice recognition based, for example, on a phrase, along with a generated QR Code is an extremely strong authentication solution, see Lakshmanaswamy et al. [12].

Lumidigm, an ATM manufacturer, is already using this principle on their machines. Their ATMs use biometrics and QR Codes for secure cash withdrawals.

6 Considerations and Remarks

The QR Codes are 2-dimensional bar codes that can be easily read by a device capable of image capture, as is the case of most existing mobile phones. These codes can represent text, an address for a web site (URL), a phone number, a geo-referenced location, an email, a contact or an SMS.

QR codes have, as the base of their error correcting structure, Hadamard matrices. The mathematical properties jointly with the new technological advances allow simple figures to contain and transmit a huge amount of information. The mathematical properties that are intrinsic to these structures will allow great advances for error detection and correction, in huge amounts of information. Potential developments using well-studied properties of randomized block designs, namely with Orthogonal Block Designs, see, e.g., Calinski and Kageyama [2] and Calinski and Kageyama [3], will create a vast spectrum of research (Fig. 11).

Fig. 11
figure 11

Damaged QR code