A post where football meets science again 🙂 This time, it’s about probabilities.
On 11 December 2017 the UEFA Champions League draw will take place. There will be 16 teams which will be drawn one against each other. There are some restrictions:
– 8 teams are seeded, the other 8 are unseeded. A seeded team can only be drawn against an unseeded team
– teams from the same country cannot be drawn against each other
– teams that already met in the previous round cannot be drawn against each other
Based on these elements, I wanted to calculate the associated probabilities, or other words to reveal the question marks in the matrix below:

(first column – seeded teams, first line – unseeded teams, greyed cells – teams cannot be drawn).

Try 1: Thursday night

I make a quick PHP script to calculate all the possible permutations (8!=40320), then I eliminate the invalid options and find that only 4238 permutations are possible. I count all the possible team pairings as below:

I calculate the associated percentage for each pair (example for Liverpool-Real it’s 799 out of 4238=18.85%) and, after half an hour spent choosing a color scheme, I put everything in the matrix:

Then I realize that the numbers are slightly different from the ones circulated on social media:

Try 2: the entire weekend

I get a very nice explanation on Twitter from the author of the tool above:

Then I start to realize that my approach was incorrect.
In fact, my numbers were only valid if the draw process consisted of a single step – somebody picking up a random number from 1 to 4238 and then showing up the 8 pairings behind that number.
But in fact, the draw process consist of 8 steps or 8 events, each one depending on the previous one. We speak in this case of conditional probabilities, which are represented using a probability tree. The probability tree for a subset of 6 teams looks like this:

And indeed, the tree simulates the real draw process and reveals the same numbers as the ‘official’ ones:

Since the draw is in less than 12 hours, I have no time to make another script that generates the full tree (that would also be too big to put in a picture). But I trust the numbers from https://eminga.github.io/cldraw/ are correct 🙂


TV connectivity round-up

Written on 2 December 2017, 09:33pm

Tagged with: , , ,

A short reminder about the ins and outs (pun intended) of the nowadays TV sets and their connected peripherals.

HDMI 1.4 vs 2.0

Official specifications of the HDMI 2.0 standard:

* Enables transmission of High Dynamic Range (HDR) video
* Bandwidth up to 18Gbps
* 4K@50/60 (2160p)
HDMI 2.0b does not define new cables or new connectors. Current High Speed cables (Category 2 cables) are capable of carrying the increased bandwidth.
The newer HDMI 2.1 specifications add support for a range of higher video resolutions and refresh rates including 8K60 and 4K120, and resolutions up to 10K. Dynamic HDR formats are also supported, and bandwidth capability is increased up to 48Gbps.

Two notes:
1. HDMI 2.0 is a hardware update, and both ends must have a HDMI 2.0 compatible chipset
2. In order to enjoy the benefits of the HDMI 2.0, the HDMI cable must be able to sustain the 18Gbps bandwidth
See more in the troubleshooting section below.

What do ARC and MHL mean?

On the back of your TV set, next to the HDMI ports you will see these 2 labels:
ARC – Audio Return Channel – enables the TV to send the audio data to the receiver. All HDMI cables support ARC by default; for TV and receivers compatibility look for the port label and/or user manual. Even if the TV has all the HDMI ports ARC-compatible, only one of them will be used at a time.
MHL – Mobile High Definition Link – allows to connect and mirror smartphones and tablets (both Android and iOS) to the TV.
On some TV sets you might also see HDCP (High-bandwidth Digital Content Protection) which implements a form of digital copy protection.

HDR standards: HDR10 vs Dolby Vision

You know how virtually all the TV producers brag about their newest models being HDR? Well, there are more standards that apply: HDR10, HDR10+, Dolby Vision, Hybrid Log-Gamma, SL-HDR1, etc.
For instance, Apple TV 4K supports the following standards:

4K Standard Dynamic Range (SDR): Used for 4K televisions that don’t support HDR10 or Dolby Vision.
4K High Dynamic Range (HDR, aka HDR10): Used for 4K televisions that support HDR to display video with a broader range of colors and luminance.
4K Dolby Vision: Used for 4K televisions that support Dolby Vision HDR to display video with a broader range of colors and luminance optimized for your television.

To see which HDR standard your TV supports, look at the fine print in the user manual (they should also indicate which HDMI port supports these HDR standards):

4:2:2? 4:2:0?

Here things become a bit more complex. If you’re not interested in the details, remember just that the higher the 3 numbers above, the better. As Apple says in the Apple TV 4K menu, “4:2:0 provides high-quality picture that is compatible with most TVs and HDMI cables. 4:2:2 improves quality, but requires high-speed cables“.

There’s a tradeoff between video quality and bandwidth. With 4K resolutions, 60Hz refresh rates, full 36-bit color depth, HDR capabilities and 32 audio channels, the bandwidth can reach incredible numbers. And as we saw above, HDMI 2.0 is limited to 18Gbps (48Gbps in HDMI 2.1). The solution is to compress the video signal exploiting the limitations of the human eye.
To make the explanation simpler, meet Chroma and Luma:

Chroma is the signal used in video systems to convey the color information
Luma represents the brightness in an image
Digital signals are often compressed. Since the human visual system is much more sensitive to variations in brightness than color, a video system can be optimized by devoting more bandwidth to the luma component (Y’, brightness), than to the color (Cb, Cr).

Below you can see how the original image is de-composed in Luma component (black and white – brightness only) and Chroma (color). The Luma is un-altered, but the Chroma is compressed (except for 4:4:4). Depending on the compression type, you can have 4:2:2, 4:2:0 or other subsampling systems (no 4-4-2 system though 🙂 ):

The bandwidth savings are impressive: the 4:2:2 sampling can reduce the necessary bandwidth to 12Gbps, while 4:2:0 further drops the requirement to 9Gbps.

Troubleshooting guide

Knowing all this, if you still have trouble getting the most of your peripherals and TV, here is a quick troubleshooting guide:
– can’t select 4:2:2 chroma: HDMI 2.0 supports 4:2:0 natively, but in order to benefit from 4:2:2 you have to upgrade your HDMI cable. Here is a decent one: Belkin Ultra High speed
– can’t select 4K HDR @60Hz: check your HDMI connectors, some manufacturers only accept HDR on HDMI1 and HDMI2 ports.
– my TV says it’s HDMI 2.0, but it’s not: well, it might be that only the port HDMI1 supports HDMI 2.0, while the others only support HDMI 1.4. That’s sad, but it can happen to older TV sets; just read the manual
– my TV won’t turn on/off when I turn on/off my peripherals: make sure you enable CEC in your TV menu. It can be named differently depending on the TV manufacturer: Bravia Sync for Sony, Anynet+ for Samsung, VIERA Link for Panasonic, EasyLink for Philips, SimpLink for LG.
– I can’t control the sound of my TV from my Apple TV remote: make your Apple TV ‘learn’ the TV remote.
– …but I have a Sonos Playbar linked to my TV: then go to your Sonos settings and pair your Sonos system with the Apple TV remote. However, be aware that a single remote can be paired with the Sonos system.

Image: https://www.dolby.com/us/en/brands/dolby-vision.html

FaceID: convenience and security

Written on 18 November 2017, 11:53pm

Tagged with: , , ,


In one of the most watched reviews of the iPhone X, Marques Brownlee was showing in a side-by-side comparison that the new FaceID is still slower than the TouchID, but it will eventually get better with software improvements. I think that in the most cases, FaceID is faster: by tapping the screen or pressing the power button to unlock your iPhone, you’re actually creating an extra step when you don’t need one. If you simply pick up the phone, then swiping up will already unlock it. Definitely faster than TouchID.
But what’s even more important, FaceID represents an important milestone in the history of biometric authentication: it’s for the first time when this process is done seamlessly, without even thinking about it. Even Brownlee admits that “facial recognition on a phone is closer to secure, seamless authentication than a separate fingerprint reader will ever be“.
After using FaceID to unlock my phone for more than two weeks I can feel that it works so well that it becomes easy to forget that the authentication actually happens. The closest to this feeling is the Apple Watch authentication model: once you put it on your hand and unlock it, it’s easy to forget that you’re authenticated (by keeping it tied to your hand) and you can receive notifications on it. The fact that the FaceID authentication is now tied to something that you’re doing with the phone anyway – that is, looking at it – makes the experience feel close to magic.

This experience can be technically described as ‘continuous authentication’: you no longer have to make a conscious gesture in order to authenticate (ex. type a PIN or put your finger on the TouchID); by simply looking at the phone you are already authenticated. Some examples:
– expand notifications and show the the control center on the lock screen
– apps using FaceID for authentication, like LastPass: after opening them, you’re already authenticated (without the need to type a password or put your finger).
– Safari browser auto-filling the passwords

Face ID is the most compelling advancement in security I have seen in a very long time. It’s game-changing not merely due to the raw technology, but also because of Apple’s design and implementation. […] The real Face ID revolution: since you’re almost always looking at your iPhone while you’re using it, Face ID enables what I call “continuous authentication.”
Rich Mogull: Face ID’s Innovation: Continuous Authentication


I described above the convenience of using FaceID and how it slowly moves us to a new era where we no longer realize we’re using biometric authentication. But how secure is it?
Before we dive into the main security concerns, it’s worth noting that before TouchID (that is a mere 4 years ago), most of us did not use a passcode on our smartphones. “Before Touch ID, about half of our users had a passcode set. Now, 9 out of 10 do.” (WWDC June 2016). With the introduction of TouchID and now FaceID, the number of people enjoying the security benefits of using a passcode is much higher.

Here are the main concerns related to FaceID:

– accidental in-app buy or download; accidental use of Apple Pay: not possible, you have to double tap the power button to enable the FaceID in order to download an app or to make a purchase
– false positive rate (security concern) / false negative rate (convenience concern): according to Apple, both fare better than TouchID
– somebody clones your face: still possible, and a valid concern if you have a high profile. But FaceID is more secure than TouchID: fabricating a 3D mask is arguably more complicated than a 3D finger.
– law enforcement forces you to unlock your iPhone using your face: the security level here is the same as for Touch ID. If you are concerned about this aspect, then simply don’t use FaceID/TouchID and rely on a strong passcode instead. If you are a just a little bit concerned, then know that holding the power and one of the volume buttons together (‘squeeze’ your iPhone) will immediately require the passcode to unlock
– somebody unlocks your phone while you are asleep: you can enable ‘require attention’. But if you are concerned about this, you have bigger issues that the security on your smartphone 🙂
More about these concerns here: Face ID, Touch ID, No ID, PINs and Pragmatic Security

The only valid concern for me is the following: a thief steals your iPhone, makes you look at it to unlock, then runs away with the unlocked phone.
In this scenario, FaceID is actually worse than TouchID – because it requires no physical contact between you and the thief. The only solution for this is to ‘Find your iphone’ and remotely wipe it, but this can take time during which valuable data can be extracted from your stolen phone. A better solution would be to immediately lock the iPhone from your Apple Watch.


There is always a trade-off between security and convenience. Sometimes compromises need to be made: security requires pragmatism. But FaceID just proved how it can address the most security concerns while providing a seamless user experience. With time, software and hardware updates, it will get even better, and we will see FaceID on other computing devices like tablets or laptops.
And from there it’s easy to imagine a keyless future. How long until you unlock your car by looking at it? Or you unlock your house by simply approaching the door and disarm your house alarm system by stepping into the hallway?
FaceID is not only an important milestone for biometric authentication, but it has the potential to change the way we interact with technology forever.