---
# System prepended metadata

title: MG1
tags: [QT]

---

# MG1
###### tags: `QT`
:::info
**Slide**
[MG1](https://drive.google.com/file/d/1Ti6dYhEZJACjOMFJz0ehqLcfq8QKdZ0W/view?usp=share_link)
[MG2](https://drive.google.com/file/d/1TqGPmLeWgvvDXp2by-24eabacE9Rr7CA/view?usp=share_link)
:::
## part 1
### 4
- N(t): can not summarize history
- Transform dimension to single dimension
- $X_0(t)$: the time is served

### 5
- Departure point: just enter the facility: no time

### 7
![](https://i.imgur.com/9Un0ZV0.png)

- When leaves behind the last state: $C_n\text{ to }C_{n+1}$ = service time + inter arrival time
- When arrival behind last state: $C_n\text{ to }C_{n+1}$: service time

### 11
- $q_n=q_{n-1}+v_n-1$

### 13
![](https://i.imgur.com/Bd5BVU7.png)
- $\alpha_k=P[\tilde{v}=k]=\int_0^\infty P[\tilde{v}=k|\tilde{x}=x]b(x)dx\\=\int_0^\infty\frac{(\lambda x)^k}{k!}e^{-\lambda x}b(x)dx$

### 15
- $C_b^2=\frac{1}{\mu^2}\cdot\mu^2=1$

### 16
- first case
![](https://i.imgur.com/axaUTQW.png)
- second case
![](https://i.imgur.com/QA5T56Y.png)
- For both we have $v_{n+1}$，$\Delta_k$ is 1 for the gap to generate

### 17
- Goal: average Q
- Expectation of $E[q]$ on both side are the same

### 18
- define z transform of v: depends on service time distribution: related to lambda

### 19
(note)[reference link]

### 20
- when the randomness is large, the len is the shortest

### 21
- $\bar{N_q}=\sum_{k=0}^{\infty}kP[\tilde{q}=k]-\sum_{k=1}^\infty P[\tilde{q}=k]=N-\rho$
- $\bar{N_q}=\bar{N}-\rho, \bar{q} = \bar{N}$

## part 2
### 1
- for M/M/1: $C_b=1,\ \bar{N}=\frac{\rho}{1-\rho},\ \bar{N_q}=\bar{N}-\rho=\frac{\rho ^2}{1-\rho}$
- $\frac{\rho}{1-\rho}: \bar{N}$ for M/M/1

### 2
![](https://i.imgur.com/wQ963bj.png)

- $\bar{q}=\rho+\rho^2\cdot\frac{1+C_b^2}{2(1-\rho)}$
- $C_b^2=\frac{\sigma_b^2}{\bar{x^2}}$
- $\bar{x}=\frac{1}{4}\cdot\frac{1}{\lambda}+\frac{3}{4}\cdot\frac{1}{2\lambda}=\frac{5}{8\lambda}$
- $\sigma_b^2=E[x^2]-(\bar{x})^2=(\frac{1}{4}\cdot\frac{2}{\lambda}+\frac{3}{4}\cdot\frac{1}{2\lambda})-\frac{25}{64\lambda^2}\\=\frac{31}{25}=1.24$
- $\rho=\frac{5}{8},\ /H_2/1:\ \bar{q}=1.79\\M/M/1:\ \bar{q}=1.66$

### 3
- derivation of T: devided by lambda

### 4
- the time only depends on the row

### 6
- $Q(z)=\frac{(1-\rho)}{(1-\rho z)}$
- $\bar{N}=Q^\prime(1)=\frac{-(-\rho)(1-\rho)}{(1-\rho)^2}|_{z=1}$
- $A\alpha^n \Leftrightarrow\frac{A}{1-\alpha z}$
- $P[\tilde{q}=k]=(1-\rho)\rho^k$

### 7
- $Q(z)=E[z^{\tilde{q}}]$
- $E[z^{q_{n+1}}]=E[z^{q_{n}-\Delta_{q_n}+v_{n+1}}]$
- [note]()
- final exam: proof the related part

### 8
- $b(x)=\frac{1}{4}\lambda e^{-\lambda x}+\frac{3}{4}(2\lambda)e^{-2\lambda x}$
![](https://i.imgur.com/41xR0Aw.png)
- $af(t)+bg(t)\Leftrightarrow aF^*(s)+bG^*(s)$
- $Q(z)=B^*(\lambda-\lambda z)\frac{(1-\rho)(1-z)}{B^*(\lambda-\lambda z)-z}$
- $s=\lambda-\lambda z$
- $B^*(s)=\frac{7\lambda s+8\lambda^2}{4(s+\lambda)(s+2\lambda)}$
- $Q(z)=\frac{(1-\rho)(1-z)[7\lambda^2-7\lambda^2z+8\lambda^2]}{[7\lambda^2-7\lambda^2z+8\lambda^2]-4z(2z-\lambda z)(3\lambda-\lambda z)}=\frac{(1-\rho)(1-(7/15)z)}{(1-(2/5)z)(1-(2/3)z)}$
- $Q(z)=\frac{3}{8}[\frac{1/4}{1-(2/5)z}-\frac{3/4}{1-(2/3)z}]$
- $p_k=(1-\rho)[\frac{1}{4}(\frac{2}{5})^k+\frac{3}{4}(\frac{2}{3})^k],\ \rho=\lambda\bar{x}=\frac{5}{8},\\\bar{x}=\frac{1}{4}\cdot\frac{1}{\lambda}+\frac{3}{4}\cdot\frac{1}{2\lambda}=\frac{5}{8\lambda},\\
p_k=\frac{3}{32}(\frac{2}{5})^k+\frac{9}{32}(\frac{2}{3})^k$
- $\bar{q}=1.79$

### 9
![](https://i.imgur.com/9WjBlU4.png)
![](https://i.imgur.com/dftTR5n.png)
- $Q(z)=S^*(\lambda-\lambda z)$

### 10
- $Q(z)=S^*(\lambda-\lambda z)=B^*(\lambda-\lambda z)\frac{(1-\rho)(1-z)}{B^*(\lambda-\lambda z)-z},\ s=\lambda-\lambda z\Rightarrow z=1-\frac{s}{\lambda}$
- $S^*(s)=B^*(s)\frac{(1-\rho)(1-1+\frac{s}{\lambda})}{B^*(s)-1+\frac{s}{\lambda}}$

### 11
- $S^*(s)=W^*(s)B^*(s)=B^*(s)\frac{s(1-\rho)}{(s-\lambda+\lambda B^*(s))}$

### 12
- $\bar{w}|_{k=1}=\frac{\lambda \bar{x^2}}{2(1-\rho)}$
- $T=\bar{x}+\frac{\rho\bar{x}(1+C_b^2)}{2(1-\rho)}$
- $\bar{s^k}=\bar{w}b_0+b_1=\bar{w}+\bar{x}$

### 14
note

### 16
- $\bar{x}=p\cdot 0+(1-p)\cdot \frac{1}{p}=\frac{1-p}{p}$
- $\frac{1}{\bar{x}}=\frac{p}{1-p}>\lambda,\ p>\frac{\lambda}{1+\lambda}$
- $\sigma_0^2=\bar{x^2}-(\bar{x})^2=\frac{2(1-p)}{p}-\frac{1-p^2}{p^2}$
- $\bar{x^2}=0\cdot p+(1-p)\frac{2}{p}=\frac{2(1-p)}{p^2}$
- waiting time: $\bar{w}=\frac{\rho}{p(1-\rho)}$
- Use PK transform equation: 
    - $W^*(s)=\frac{s(1-\rho)}{s\lambda+\lambda B^*(s)}=$
    - $b(x)=p\cdot u_0(x)+(1-p)p e^{-px}$
    - $B^*(s)=p\cdot 1+(1-p)\cdot \frac{p}{s+p}$
    - $W^*(s)=\frac{s(1-\rho)}{s-\lambda+\lambda\cdot\frac{p(s+1)}{s+p}}=\frac{(1-\rho)(s+p)}{s+p(1-\frac{\lambda(1-p)}{p})}=\frac{(1-p)(s+p)}{s+p(1-\rho)}$
    - $u_0=\begin{cases}\infty && t=0\\o && t\neq 0\end{cases}$
    - Convert transform to distribution function: partial fraction expression
    - $W^*(s)=(1-\rho)+\frac{p\rho(1-\rho)}{s+p(1-\rho)}$
    - $w(y)=(1-\rho)\cdot u_0(y)+p\rho(1-\rho)e^{-p(1-\rho)y}$
    - Take integral: of the last one for both val: $w(y)=1-\rho e^{-p(1-\rho)y},\ y\geq 0$

## MG2 III
### 2
- 