The Intersection of Topologies result in a Topology

Topology is the study of invariant properties of mathematical objects. Through the study of topology, mathematicians to translate properties between mathematical objects. There are many different subfields of topology, e.g. general topology (a.k.a. point-set topology), algebraic topology, etc. Unfortunately (or fortunately?), I have only encountered general topology in my undergraduate degree.

Perhaps one interesting (basic) result in topology is as follows

Given a space $X$ and a collection of topologies $\tau_i$, where $i \in I$ and $I$ is an index set, the intersection $\bigcap_{i \in I} \tau_i$ is also a topology on $X$.

Given a collection of objects that share property a property, let’s say property $a$, we do not expect the union and intersection of this collection to share the same properties. For instance, the set $\{n\}$, where $n$ is an integer, is finite. But when you take the union of all singleton set (namely $\{n\}$), we have an infinite set.

So why is the above statement true? To prove this, we need need at least the definition of a topology, so here it goes:

Let $X$ be a set, and $\mathcal{P}(X)$ be its power set. A subset $\tau \subseteq \mathcal{P}(X)$ is called a topology if the following conditions hold:

1. $\emptyset, X \in \tau$
2. Arbitrary union of elements of $\tau$ is also an element of $\tau$, i.e. $\bigcup_{\lambda \in \Lambda} U_{\lambda} \in \tau$ where $U_{\lambda} \in \tau$ is arbitrarily chosen.
3. Finite intersection of elements of $\tau$ is also an element of $\tau$, i.e. if $n \in \mathbb{Z}$, then $\bigcap_{i=1}^n U_{i} \in \tau$ where $U_{i} \in \tau$ is arbitrarily chosen

So far so good. Now that we know the definition of a topology, we can easily see that the union of topologies is NOT a topology; consider $X = \{a,b,c\}$, and we have two topologies $\tau_1 = \{\emptyset, \{a\}, X\}$ and $\tau_2 = \{\emptyset, \{b\}, X\}$, then the union is

$\tau_1 \cup \tau_2 = \{\emptyset, \{a\},\{b\},X\}$

This violates the arbitrary union property; $\{a\}$ and $\{b\}$ are elements of the union, but $\{a\} \cup \{b\} = \{a,b\}$ is not. Note that this is not to say that all unions of topologies does not result in a topology; it is only the counterexample to the claim that all unions of topologies gives a topology.

We have shown above that the union of topologies itself need not be a topology. So why is the intersection of of topologies is itself a topology? Clearly, by definition of topology, each topology includes the sets $\emptyset$ and $X$, thus the empty set $\emptyset$ and $X$ is in the intersection. Now let $I$ be an index set, and for $i \in I$, $U_{i} \in \bigcap_{\lambda \in \Lambda} \tau_{\lambda}$ be an arbitrary family of elements in the intersection of the topologies. Then by definition of topology, arbitrary unions of elements in $\{U_i\}_{i \in I}$ is also in $\tau_{\lambda}$ for all $\lambda \in \Lambda$. Thus the arbitrary union is also an element of $\bigcap_{\lambda \in \Lambda} \tau_{\lambda}$. By similar reasoning, we can also conclude that finite intersection of elements in $\bigcap_{\lambda \in \Lambda} \tau_{\lambda}$ is also an element of $\bigcap_{\lambda \in \Lambda} \tau_{\lambda}$ itself. Thus $\bigcap_{\lambda \in \Lambda} \tau_{\lambda}$ is a topology.

Arch Linux

Arch Linux Installation Notes II: Configuring Users and Desktop Environment

So we have installed Arch Linux, but the only user currently is the root user, and there is no desktop environment, i.e. the system is in command line interface (CLI) instead of graphical user interface (GUI). This is dangerous and not user friendly, as doing everything with root user poses a threat that one might accidentally delete important files (from personal experience using sudo, enough said), and not everyone likes CLI. Luckily, none of these tasks are hard, but we will do it step by step.

Creating Users and Groups

To create a new user, we use the useradd command. We will want to add the new user into the group wheel. So we do the following: useradd -m -G wheel -s /bin/bash . Read here for more details on users and user groups. Then to add a password for the user, passwd  and enter the same password twice. Note: The password is case sensitive, and we should see

passwd: password updated successfully

Great! Now we have set up a new user, but sometimes, we still want to have root access to do install/update a package, and this usually requires sudo. However, if we just log in as the user that we have just created, we will see

  <username> is not in the sudoers file. This incident will be reported.

And as mentioned before, it is discouraged to do everything with the root user. To add the newly created user to one of the sudoers, we need to edit the /etc/sudoerFriendly reminder that we should use visudo to edit the file instead of other editors. To do this, enter visudo -f /etc/sudoers. This should be done with the root user. Then go to the line root ALL=(ALL) ALL, copy and paste the line below and changing root to <username>. Now save and quit by typing :wq, including the colon. Now reboot and the new user should be able to use sudo now.

Desktop Environment

There are a lot of choices in terms of desktop environment using GUI. Some supported GUI ones can be found here. In this post however, we will install GNOME; people have different comment on this environment, I personally do not hold any grudges or irrational hate towards GNOME, but some of my friends does. This is up to personal preference, but I find installing GNOME is slightly easier than the other environments. Maybe I will write a post in the future about installing XFCE instead.

To install GNOME, type pacman -S gnome gnome-extra, and if no preference for login screen, we can append gdm (for other display manager see here) after gnome-extra​.

Starting a GNOME session

For different types of GNOME sessions click here. I will setup the environment using Xorg.

To run a Xorg GNOME session, first, install Xorg by pacman -S xorg xorg-xinit, then type startx. However, if we want to start the computer with GUI, we need to modify the ~/.xinitrc file. Append exec gnome-session at the end of the ~/.xinitrc file. Reboot, and we should be good.

Starting GDM on Boot

To start GDM on boot, enable its systemd service, i.e. systemctl enable gdm.service. Note: You have to use sudo for this, or enable this as root.

Arch Linux Installation Notes I: Installing the System

Many people seemed to be genuinely surprised when they first know that I do not use Windows. I have moved away from Windows for about 3 years now, mainly due to programming work, as well as having to run statistical analysis/machine learning codes (programs, if you prefer) overnight. Using Windows for either purpose has essentially given me an awful experience; more than once, it has rebooted while my program was running overnight, and often throws random permission errors even though I am the only administrator on my laptop. This blog entry is some notes and thoughts while installing Arch Linux on my 5-year-old laptop.

First and foremost, please read the Arch Linux Installation/Beginner’s Guide. It is really helpful. Secondly, download the iso image file, we will need to create a live USB flash drive for the installer. The next step depends on the OS that we are using, but I only know how to do it with Linux systems (apologizing to people using Windows and MacOS). To create a live USB installation medium, prepare a USB flash drive ( 2 GB is more than enough), and plug it into the USB port on the computer.

Creating Live USB Key

Now for Linux system, first ensure that the USB flash drive is detected, and is not mounted. To do this, first enter the following commands into the terminal
fdisk -l. This will show all the drives that are detected by the system. Usually, they are named /dev/sdb or in case of a hybrid drive  (SSD + HDD), it will show up as /dev/sdc.  Run lsblk to make sure that the USB key is not mounted.

Now we will assume that the USB drive is name /dev/sdb for simplicity (in Arch Linux wiki, it is usually denoted with /dev/sdx instead, in case anyone reads it and wonder what it is). Then open terminal, and type in

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdb status=progress && sync

Here, the if option means input file and of means output file. Now sit back and relax, the computer will do the rest to create a live USB key.

Installing Arch Linux

First plugin the USB key and reboot the computer. Whenever possible (usually at the beginning while booting), press F12 to enter boot menu. There, we should see the live USB flash drive that we have just created as an option, choose this and wait for it to boot.

Before we setup any installation, we need to verify the boot mode. Enter ls /sys/firmware/efi/efivars and make sure the system is booting in UEFI mode. If the directory does not exists (i.e. nothing shows up upon hitting Enter/Return key), then the system is either booting in BIOS or CSM mode. To check this, press F2 before booting the system (before F12) and we should see the boot mode. The installation process is basically still the same, with BIOS and CSM having an extra step or two. Personally, I have to go through the BIOS installation process.

Connecting to the Internet

To install Arch Linux, we must have an Internet connection, either through Ethernet or WiFi. To check if the Internet is connected, type ping archlinux.org. If the laptop starts pinging responding, then we are done! Otherwise, we should see something as follows

ping: archlinux.org: Name or service not known

To set up the Internet through WiFi, first type in wifi-menu -o <interface> where <interface> can be obtained by either checking ip link or iw dev. It often looks something like wlpxxx replacing the last three x’s appropriately. Here, we will just use wlan0 as a substitute. Then we are required to select the network and key in the password, and voila! We are now connected to the Internet through WiFi. (Optional: Do ping archlinux.org again to confirm the computer is actually connected to the Internet. Or not. I am not a police.)

Update System Clock (Optional)

Enter timedatectl set-ntp true into the console. This will set the clock to be in sync with the UTC time (i.e. timezone +00:00). Use timedatectl status to check that the time is indeed correct. To set timezone, do timedatectl set-timezone <timezone name> where <timezone name> can be obtained via timedatectl list-timezone.

Partitioning the Disks

Check the name of the disks using fdisk -l. We should see a list of /dev/sdx followed with /dev/sdxY for each disks, including the USB flash drive. The Y here should be a partition number of /dev/sdx, and there can be multiple of them.

Using cfdisk or parted, we can partition the disk into different partitions. In my case (BIOS Boot System) , I need 4 partitions:

• BIOS Bootable System (BIOS boot)
• Root directory, i.e. / (Linux File System)
• Swap partition (Linux Swap)
• Home directory i.e. ~/home (Linux File System)

Note that the partition above is for BIOS boot mode only, where the BIOS bootable system is the first 1007 KB of the disk. There are other partition layouts. For more examples click on this link.

Remark: My swap partition is the size of my RAM, but the actual size can vary. For the root directory, I have about I used 10 GB 2 GB space allocated to it, which should be more than enough. Usually home directory gets the rest of the space, and in case of a hybrid drive, the root directory and swap space should be on SSD while home directory should be on HDD.

Formatting the Disks

To format the disks, we need to format it according tot he type. Using above example, Linux file systems can be formatted using mkfs.ext4 /dev/sda1, assuming my /dev/sda1 has partition type Linux file system. Assuming /dev/sda3 is of type EFI System, then we need mkfs.vfat /dev/sda3. For Linux swap, (in my case, /dev/sda2) we need to first do mkswap /dev/sda2 and then swapon /dev/sda2. Details of formatting for each partition type can be found here.

Mounting the Disks

There are several ways to do this, depending on the partitions. For simplicity, assume the following from now onwards:

• /dev/sda1 is for the partition for root directory
• /dev/sda2 is the swap partition
• /dev/sda3 is the partition for home directory

Then we should first mount the root directory partition onto /mnt. Simply type mount /dev/sda1 /mnt to do this. Next, we will need to create /mnt/home for home directory, which we can do by typing mkdir /mnt/home, and to mount this drive, we need to follow up with mount /dev/sda3 /mnt/home. To check which directory is mounted and the details, type lsblk -f.

Installing the system

Now we can finally install the system. Use pacstrap /mnt base, or personally, I prefer pacstrap /mnt base base-devel as it install some of the functionalities that I already am using. Generally speaking, to install a package, simply append to the command with the package name, followed with a space (so to install GRUB just do pacstrap /mnt base grub. Now we can sit back and relax for a bit, it will take some time to install.

Configuring the system

We need to now generate the fstab file, using UUID or by the labels. So type genfstab -U /mnt >> /mnt/etc/fstab if UUID is used, otherwise replace -U with -L instead. Now we need to configure the local system itself. This is very standard. Do arch-chroot /mnt, and then just follow the Arch Wiki Guide until the last step, where we are required to run the boot loader. In general, run

grub-install --target=i386-pc /dev/sda

Then, we want to do

grub-mkconfig -o /boot/grub/grub.cfg

to allow the microcode to update and configure GRUB appropriately. Now type exit and reboot the system. Remember to unplug the USB flash drive at this point.

Congratulations! We have now installed Arch Linux on our computer. For some of us, great! Now we can play with our new toy. For others, this is bad news. Basic Arch Linux is running on Command Line Interface (CLI), but do not be afraid! We can configure a desktop environment running on Arch Linux! Read this for some general recommendations on how to manage the system, and [this]9https://wiki.archlinux.org/index.php/List_of_applications) for a list of applications that is useful. I would suggest first adding a user, setting up a desktop environment, and configuring NVIDIA if required.

Hypergraphs: Introduction

Graph theory is the study of graphs, which can be used to model relationships, routes, etc. People understands a lot about graphs. However, there is a generalisation of graph theory that we can talk about – the hypergraphs!
Like graph theory, hypergraphs contains vertices, denoted by $V$, and edges which we call hyperedges, denoting $E$. Instead of connecting two vertices $u,v \in V$, a hyperedge $e \in E$ connects any subset of $V$, i.e. $e$ is an element of the power set of the vertices.

Intuitively, hypergraphs are just a set of vertices, and hyperedges are lines that connects some vertices together. For instance, the $n \times n$ grid is a hyper graph, with $n^2$ vertices and $2n$ hyperedges. In the $n \times n$ grid, each pair of hyperedges, $e,e' \in E$ intersects at a vertex $v \in V$ uniquely. Another example of a hypergraph is the Fano plane, which is the hypergraph below

As we can see, there are seven vertices in total in the hypergraph above. There are also seven hyperedges in the hypergraph above, each hyperedge is represented by a unique colour itself.

We can also talk about the properties of a hypergraph just as we do in normal graphs. Recall that in a graph, we say that a graph is $k$-regular if each vertex has exactly degree $k$. Similarly, a hypergraph is $k$-regular if for each vertex in the hypergraph, the degree of the vertex (number of lines that pass through a vertex) is exactly degree $k$. So a $n \times n$-grid is 2-regular, and the Fano plane is 3-regular.

Another interesting property that we want to inherit from graph theory is the dual. Amazingly, basic properties of duality that we learn from normal graph theory is also true for hypergraphs. Perhaps the most important such property is that $G^{**} \cong G$ for any hypergraph $G$, where $G^*$ denotes the dual graph of the graph $G$. This is another post for another time.

There are many other types of hypergraphs, and they are used in many ways. Hopefully this post helps you with some intuition in hypergraphs.