```python
OABC is any quadrilateral in 3D space. 
P is the midpoint of OA, Q is the midpoint of AB, R is the midpoint of BC and S is the midpoint of OC. 
Prove that PQ is parallel to SR
```


```python
#Define a coordinate system
from sympy.vector import CoordSys3D
Sys = CoordSys3D('Sys')
```


```python
# Define point O to be Sys’ origin. We can do this without loss of generality
O = Sys.origin

```


```python
#Define point A with respect to O

from sympy import symbols
a1, a2, a3 = symbols('a1 a2 a3')
A = O.locate_new('A', a1*Sys.i + a2*Sys.j + a3*Sys.k)
```




$\displaystyle Point\left(A, (a_{1})\mathbf{\hat{i}_{Sys}} + (a_{2})\mathbf{\hat{j}_{Sys}} + (a_{3})\mathbf{\hat{k}_{Sys}}, Point\left(Sys.origin, \mathbf{\hat{0}}\right)\right)$




```python
A
```




$\displaystyle Point\left(A, (a_{1})\mathbf{\hat{i}_{Sys}} + (a_{2})\mathbf{\hat{j}_{Sys}} + (a_{3})\mathbf{\hat{k}_{Sys}}, Point\left(Sys.origin, \mathbf{\hat{0}}\right)\right)$




```python
# Similarly define points B and C

b1, b2, b3 = symbols('b1 b2 b3')
B = O.locate_new('B', b1*Sys.i + b2*Sys.j + b3*Sys.k)
c1, c2, c3 = symbols('c1 c2 c3')
C = O.locate_new('C', c1*Sys.i + c2*Sys.j + c3*Sys.k)
```


```python
B
```




$\displaystyle Point\left(B, (b_{1})\mathbf{\hat{i}_{Sys}} + (b_{2})\mathbf{\hat{j}_{Sys}} + (b_{3})\mathbf{\hat{k}_{Sys}}, Point\left(Sys.origin, \mathbf{\hat{0}}\right)\right)$




```python
C
```




$\displaystyle Point\left(C, (c_{1})\mathbf{\hat{i}_{Sys}} + (c_{2})\mathbf{\hat{j}_{Sys}} + (c_{3})\mathbf{\hat{k}_{Sys}}, Point\left(Sys.origin, \mathbf{\hat{0}}\right)\right)$




```python
# P is the midpoint of OA. Lets locate it with respect to O (you could also define it with respect to A).
P = O.locate_new('P', A.position_wrt(O) + (O.position_wrt(A) / 2))
P
```




$\displaystyle Point\left(P, (\frac{a_{1}}{2})\mathbf{\hat{i}_{Sys}} + (\frac{a_{2}}{2})\mathbf{\hat{j}_{Sys}} + (\frac{a_{3}}{2})\mathbf{\hat{k}_{Sys}}, Point\left(Sys.origin, \mathbf{\hat{0}}\right)\right)$




```python
# Similarly define points Q, R and S as per the problem definitions.
Q = A.locate_new('Q', B.position_wrt(A) / 2)
R = B.locate_new('R', C.position_wrt(B) / 2)
S = O.locate_new('R', C.position_wrt(O) / 2)
```


```python
Q
```




$\displaystyle Point\left(Q, (- \frac{a_{1}}{2} + \frac{b_{1}}{2})\mathbf{\hat{i}_{Sys}} + (- \frac{a_{2}}{2} + \frac{b_{2}}{2})\mathbf{\hat{j}_{Sys}} + (- \frac{a_{3}}{2} + \frac{b_{3}}{2})\mathbf{\hat{k}_{Sys}}, Point\left(A, (a_{1})\mathbf{\hat{i}_{Sys}} + (a_{2})\mathbf{\hat{j}_{Sys}} + (a_{3})\mathbf{\hat{k}_{Sys}}, Point\left(Sys.origin, \mathbf{\hat{0}}\right)\right)\right)$




```python
R
```




$\displaystyle Point\left(R, (- \frac{b_{1}}{2} + \frac{c_{1}}{2})\mathbf{\hat{i}_{Sys}} + (- \frac{b_{2}}{2} + \frac{c_{2}}{2})\mathbf{\hat{j}_{Sys}} + (- \frac{b_{3}}{2} + \frac{c_{3}}{2})\mathbf{\hat{k}_{Sys}}, Point\left(B, (b_{1})\mathbf{\hat{i}_{Sys}} + (b_{2})\mathbf{\hat{j}_{Sys}} + (b_{3})\mathbf{\hat{k}_{Sys}}, Point\left(Sys.origin, \mathbf{\hat{0}}\right)\right)\right)$




```python
S
```




$\displaystyle Point\left(R, (\frac{c_{1}}{2})\mathbf{\hat{i}_{Sys}} + (\frac{c_{2}}{2})\mathbf{\hat{j}_{Sys}} + (\frac{c_{3}}{2})\mathbf{\hat{k}_{Sys}}, Point\left(Sys.origin, \mathbf{\hat{0}}\right)\right)$




```python
# Now compute the vectors in the directions specified by PQ and SR.
PQ = Q.position_wrt(P)
SR = R.position_wrt(S)
```




$\displaystyle (\frac{b_{1}}{2})\mathbf{\hat{i}_{Sys}} + (\frac{b_{2}}{2})\mathbf{\hat{j}_{Sys}} + (\frac{b_{3}}{2})\mathbf{\hat{k}_{Sys}}$




```python
PQ
```




$\displaystyle (\frac{b_{1}}{2})\mathbf{\hat{i}_{Sys}} + (\frac{b_{2}}{2})\mathbf{\hat{j}_{Sys}} + (\frac{b_{3}}{2})\mathbf{\hat{k}_{Sys}}$




```python
SR
```




$\displaystyle (\frac{b_{1}}{2})\mathbf{\hat{i}_{Sys}} + (\frac{b_{2}}{2})\mathbf{\hat{j}_{Sys}} + (\frac{b_{3}}{2})\mathbf{\hat{k}_{Sys}}$




```python
# Compute cross product
PQ.cross(SR)
```




$\displaystyle \mathbf{\hat{0}}$




```python
# Since the cross product is a zero vector, the two vectors have to be parallel, thus proving that PQ || SR.
```

c0b747cfd94e3a22218a82100ced3ba43c0be594
ipynb
Jupyter Notebook
Personal_Projects/vector math calculus 1.ipynb
NSC9/Sample_of_Work
8f8160fbf0aa4fd514d4a5046668a194997aade6
MIT
Personal_Projects/vector math calculus 1.ipynb
NSC9/Sample_of_Work
8f8160fbf0aa4fd514d4a5046668a194997aade6
MIT
Personal_Projects/vector math calculus 1.ipynb
NSC9/Sample_of_Work
8f8160fbf0aa4fd514d4a5046668a194997aade6
MIT
Qwen/Qwen-72B
1. YES
2. YES